Add bisqJS and liquidJS npm modules.
This commit is contained in:
parent
acc0c80953
commit
4efc927303
23
examples/html/bisq-js/addresses.html
Normal file
23
examples/html/bisq-js/addresses.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../dist/bisq.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const { addresses } = bisqJS();
|
||||
|
||||
const address = 'B1DgwRN92rdQ9xpEVCdXRfgeqGw9X4YtrZz';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
33
examples/html/bisq-js/blocks.html
Normal file
33
examples/html/bisq-js/blocks.html
Normal file
@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../dist/bisq.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const { blocks } = bisqJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000000079aa6bfa46eb8fc20474e8673d6e8a123b211236bf82d';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const myBlocks = await blocks.getBlocks({ index: 0, length: 1 });
|
||||
console.log(myBlocks);
|
||||
|
||||
const myBlocksHeight = await blocks.getBlocksTipHeight({
|
||||
index: 0,
|
||||
length: 1,
|
||||
});
|
||||
console.log(myBlocksHeight);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
46
examples/html/bisq-js/markets.html
Normal file
46
examples/html/bisq-js/markets.html
Normal file
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../dist/bisq.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const { markets } = bisqJS();
|
||||
|
||||
const market = "BTC_USD";
|
||||
const basecurrency = "BTC";
|
||||
|
||||
const allMarkets = await markets.getMarkets();
|
||||
console.log(allMarkets);
|
||||
|
||||
const currencies = await markets.getCurrencies();
|
||||
console.log(currencies);
|
||||
|
||||
const depth = await markets.getDepth({ market });
|
||||
console.log(depth)
|
||||
|
||||
const hloc = await markets.getHloc({ market });
|
||||
console.log(hloc);
|
||||
|
||||
const offers = await markets.getOffers({ market });
|
||||
console.log(offers);
|
||||
|
||||
const ticker = await markets.getTicker({ market });
|
||||
console.log(ticker);
|
||||
|
||||
const trades = await markets.getTrades({ market });
|
||||
console.log(trades);
|
||||
|
||||
const volumes = await markets.getVolumes({ basecurrency, market });
|
||||
console.log(volumes);
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
21
examples/html/bisq-js/statistics.html
Normal file
21
examples/html/bisq-js/statistics.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../dist/bisq.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const { statistics } = bisqJS();
|
||||
|
||||
const stats = await statistics.getStats();
|
||||
console.log(stats);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
28
examples/html/bisq-js/transactions.html
Normal file
28
examples/html/bisq-js/transactions.html
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../dist/bisq.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const { transactions } = bisqJS();
|
||||
|
||||
const txid =
|
||||
'4b5417ec5ab6112bedf539c3b4f5a806ed539542d8b717e1c4470aa3180edce5';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txs = await transactions.getTxs({ index: 0, length: 1 });
|
||||
console.log(txs);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,21 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
bisq: { addresses },
|
||||
} = mempoolJS();
|
||||
|
||||
const address = 'B1DgwRN92rdQ9xpEVCdXRfgeqGw9X4YtrZz';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,31 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
bisq: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000000079aa6bfa46eb8fc20474e8673d6e8a123b211236bf82d';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const myBlocks = await blocks.getBlocks({ index: 0, length: 1 });
|
||||
console.log(myBlocks);
|
||||
|
||||
const myBlocksHeight = await blocks.getBlocksTipHeight({
|
||||
index: 0,
|
||||
length: 1,
|
||||
});
|
||||
console.log(myBlocksHeight);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,19 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
bisq: { statistics },
|
||||
} = mempoolJS();
|
||||
|
||||
const stats = await statistics.getStats();
|
||||
console.log(stats);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,24 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
bisq: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid = 'B1DgwRN92rdQ9xpEVCdXRfgeqGw9X4YtrZz';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txs = await transactions.getTxs({ index: 0, length: 1 });
|
||||
console.log(txs);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,35 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { addresses },
|
||||
} = mempoolJS();
|
||||
|
||||
const address = '1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
|
||||
const addressTxs = await addresses.getAddressTxs({ address });
|
||||
console.log(addressTxs);
|
||||
|
||||
const addressTxsChain = await addresses.getAddressTxsChain({ address });
|
||||
console.log(addressTxsChain);
|
||||
|
||||
const addressTxsMempool = await addresses.getAddressTxsMempool({
|
||||
address,
|
||||
});
|
||||
console.log(addressTxsMempool);
|
||||
|
||||
const addressTxsUtxo = await addresses.getAddressTxsUtxo({ address });
|
||||
console.log(addressTxsUtxo);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,52 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000015dc777b3ff2611091336355d3f0ee9766a2cf3be8e4b1ce';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const blockStatus = await blocks.getBlockStatus({ hash });
|
||||
console.log(blockStatus);
|
||||
|
||||
const blockTxs = await blocks.getBlockTxs({ hash });
|
||||
console.log(blockTxs);
|
||||
|
||||
const blockTxids = await blocks.getBlockTxids({ hash });
|
||||
console.log(blockTxids);
|
||||
|
||||
const blockTxid = await blocks.getBlockTxid({ hash, index: 218 });
|
||||
console.log(blockTxid);
|
||||
|
||||
const blockRaw = await blocks.getBlockRaw({ hash });
|
||||
console.log(blockRaw);
|
||||
|
||||
const blockHeader = await blocks.getBlockHeader({ hash });
|
||||
console.log(blockHeader);
|
||||
|
||||
const blockHeight = await blocks.getBlockHeight({ height: 0 });
|
||||
console.log(blockHeight);
|
||||
|
||||
const getBlocks = await blocks.getBlocks({ start_height: 9999 });
|
||||
console.log(getBlocks);
|
||||
|
||||
const blocksTipHeight = await blocks.getBlocksTipHeight();
|
||||
console.log(blocksTipHeight);
|
||||
|
||||
const blocksTipHash = await blocks.getBlocksTipHash();
|
||||
console.log(blocksTipHash);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { difficulty },
|
||||
} = mempoolJS();
|
||||
|
||||
const difficultyAdjustment = await difficulty.getDifficultyAdjustment();
|
||||
console.log(difficultyAdjustment);
|
||||
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,22 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { fees },
|
||||
} = mempoolJS();
|
||||
|
||||
const feesRecommended = await fees.getFeesRecommended();
|
||||
console.log(feesRecommended);
|
||||
|
||||
const feesMempoolBlocks = await fees.getFeesMempoolBlocks();
|
||||
console.log(feesMempoolBlocks);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { mempool },
|
||||
} = mempoolJS();
|
||||
|
||||
const getMempool = await mempool.getMempool();
|
||||
console.log(getMempool);
|
||||
|
||||
const getMempoolRecent = await mempool.getMempoolRecent();
|
||||
console.log(getMempoolRecent);
|
||||
|
||||
const getMempoolTxids = await mempool.getMempoolTxids();
|
||||
console.log(getMempoolTxids);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,51 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid =
|
||||
'15e10745f15593a899cef391191bdd3d7c12412cc4696b7bcb669d0feadc8521';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txStatus = await transactions.getTxStatus({ txid });
|
||||
console.log(txStatus);
|
||||
|
||||
const txHex = await transactions.getTxHex({ txid });
|
||||
console.log(txHex);
|
||||
|
||||
const txRaw = await transactions.getTxRaw({ txid });
|
||||
console.log(txRaw);
|
||||
|
||||
const txMerkleBlockProof = await transactions.getTxMerkleBlockProof({
|
||||
txid,
|
||||
});
|
||||
console.log(txMerkleBlockProof);
|
||||
|
||||
const txMerkleProof = await transactions.getTxMerkleProof({ txid });
|
||||
console.log(txMerkleProof);
|
||||
|
||||
const txOutspend = await transactions.getTxOutspend({
|
||||
txid,
|
||||
vout: 3,
|
||||
});
|
||||
console.log(txOutspend);
|
||||
|
||||
const txOutspends = await transactions.getTxOutspends({ txid });
|
||||
console.log(txOutspends);
|
||||
|
||||
// const postTx = await transactions.postTx({ txid });
|
||||
// console.log(postTx);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,36 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { websocket },
|
||||
} = mempoolJS();
|
||||
|
||||
const ws = websocket.initClient({
|
||||
options: ['blocks', 'stats', 'mempool-blocks', 'live-2h-chart'],
|
||||
});
|
||||
|
||||
ws.addEventListener('message', function incoming({data}) {
|
||||
const res = JSON.parse(data.toString());
|
||||
if (res.blocks) {
|
||||
console.log(res.blocks);
|
||||
}
|
||||
if (res.mempoolInfo) {
|
||||
console.log(res.mempoolInfo);
|
||||
}
|
||||
if (res.transactions) {
|
||||
console.log(res.transactions);
|
||||
}
|
||||
if (res.mempoolBlocks) {
|
||||
console.log(res.mempoolBlocks);
|
||||
}
|
||||
});
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
37
examples/html/liquid-js/addresses.html
Normal file
37
examples/html/liquid-js/addresses.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../dist/liquid.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const { addresses } = liquidJS();
|
||||
|
||||
const address = 'Go65t19hP2FuhBMYtgbdMDgdmEzNwh1i48';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
|
||||
const addressTxs = await addresses.getAddressTxs({ address });
|
||||
console.log(addressTxs);
|
||||
|
||||
const addressTxsChain = await addresses.getAddressTxsChain({ address });
|
||||
console.log(addressTxsChain);
|
||||
|
||||
const addressTxsMempool = await addresses.getAddressTxsMempool({
|
||||
address,
|
||||
});
|
||||
console.log(addressTxsMempool);
|
||||
|
||||
const addressTxsUtxo = await addresses.getAddressTxsUtxo({ address });
|
||||
console.log(addressTxsUtxo);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
35
examples/html/liquid-js/assets.html
Normal file
35
examples/html/liquid-js/assets.html
Normal file
@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../dist/liquid.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const { assets } = liquidJS();
|
||||
|
||||
const asset_id = 'a0c358a0f6947864af3a06f3f6a2aeb304df7fd95c922f2f22d7412399ce7691';
|
||||
|
||||
const asset = await assets.getAsset({ asset_id });
|
||||
console.log(asset);
|
||||
|
||||
const assetTxs = await assets.getAssetTxs({
|
||||
asset_id,
|
||||
is_mempool: false,
|
||||
});
|
||||
console.log(assetTxs);
|
||||
|
||||
const assetSupply = await assets.getAssetSupply({
|
||||
asset_id,
|
||||
decimal: false,
|
||||
});
|
||||
console.log(assetSupply);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
51
examples/html/liquid-js/blocks.html
Normal file
51
examples/html/liquid-js/blocks.html
Normal file
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../dist/liquid.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const { blocks } = liquidJS();
|
||||
|
||||
const hash =
|
||||
'54f02bdec5509ea769c8be82aed51f689969b653d92a2812d5a36266cbfbc55e';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const blockStatus = await blocks.getBlockStatus({ hash });
|
||||
console.log(blockStatus);
|
||||
|
||||
const blockTxs = await blocks.getBlockTxs({ hash });
|
||||
console.log(blockTxs);
|
||||
|
||||
const blockTxids = await blocks.getBlockTxids({ hash });
|
||||
console.log(blockTxids);
|
||||
|
||||
const blockTxid = await blocks.getBlockTxid({ hash, index: 0 });
|
||||
console.log(blockTxid);
|
||||
|
||||
const blockRaw = await blocks.getBlockRaw({ hash });
|
||||
console.log(blockRaw);
|
||||
|
||||
const blockHeight = await blocks.getBlockHeight({ height: 0 });
|
||||
console.log(blockHeight);
|
||||
|
||||
const getBlocks = await blocks.getBlocks({ start_height: 9999 });
|
||||
console.log(getBlocks);
|
||||
|
||||
const blocksTipHeight = await blocks.getBlocksTipHeight();
|
||||
console.log(blocksTipHeight);
|
||||
|
||||
const blocksTipHash = await blocks.getBlocksTipHash();
|
||||
console.log(blocksTipHash);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
24
examples/html/liquid-js/fees.html
Normal file
24
examples/html/liquid-js/fees.html
Normal file
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../dist/liquid.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const { fees } = liquidJS();
|
||||
|
||||
const feesRecommended = await fees.getFeesRecommended();
|
||||
console.log(feesRecommended);
|
||||
|
||||
const feesMempoolBlocks = await fees.getFeesMempoolBlocks();
|
||||
console.log(feesMempoolBlocks);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
27
examples/html/liquid-js/mempool.html
Normal file
27
examples/html/liquid-js/mempool.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../dist/liquid.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const { mempool } = liquidJS();
|
||||
|
||||
const getMempool = await mempool.getMempool();
|
||||
console.log(getMempool);
|
||||
|
||||
const getMempoolRecent = await mempool.getMempoolRecent();
|
||||
console.log(getMempoolRecent);
|
||||
|
||||
const getMempoolTxids = await mempool.getMempoolTxids();
|
||||
console.log(getMempoolTxids);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
48
examples/html/liquid-js/transactions.html
Normal file
48
examples/html/liquid-js/transactions.html
Normal file
@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../dist/liquid.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const { transactions } = liquidJS();
|
||||
|
||||
const txid =
|
||||
'f4e0cae35f8eb239c1eee9177884582aa6e4ce41e919f276617e9c7557168b53';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txStatus = await transactions.getTxStatus({ txid });
|
||||
console.log(txStatus);
|
||||
|
||||
const txHex = await transactions.getTxHex({ txid });
|
||||
console.log(txHex);
|
||||
|
||||
const txRaw = await transactions.getTxRaw({ txid });
|
||||
console.log(txRaw);
|
||||
|
||||
const txMerkleProof = await transactions.getTxMerkleProof({ txid });
|
||||
console.log(txMerkleProof);
|
||||
|
||||
const txOutspend = await transactions.getTxOutspend({ txid, vout: 3 });
|
||||
console.log(txOutspend);
|
||||
|
||||
const txOutspends = await transactions.getTxOutspends({ txid });
|
||||
console.log(txOutspends);
|
||||
|
||||
const txMerkleBlockProof = await transactions.getTxMerkleBlockProof({ txid });
|
||||
console.log(txMerkleBlockProof);
|
||||
|
||||
// const postTx = await transactions.postTx({ txhex });
|
||||
// console.log(postTx);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
38
examples/html/liquid-js/websocket.html
Normal file
38
examples/html/liquid-js/websocket.html
Normal file
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../dist/liquid.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const { websocket } = liquidJS();
|
||||
|
||||
const ws = websocket.initClient({
|
||||
options: ['blocks', 'stats', 'mempool-blocks', 'live-2h-chart'],
|
||||
});
|
||||
|
||||
ws.addEventListener('message', function incoming({data}) {
|
||||
const res = JSON.parse(data.toString());
|
||||
if (res.blocks) {
|
||||
console.log(res.blocks);
|
||||
}
|
||||
if (res.mempoolInfo) {
|
||||
console.log(res.mempoolInfo);
|
||||
}
|
||||
if (res.transactions) {
|
||||
console.log(res.transactions);
|
||||
}
|
||||
if (res.mempoolBlocks) {
|
||||
console.log(res.mempoolBlocks);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,35 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { addresses },
|
||||
} = mempoolJS();
|
||||
|
||||
const address = '1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
|
||||
const addressTxs = await addresses.getAddressTxs({ address });
|
||||
console.log(addressTxs);
|
||||
|
||||
const addressTxsChain = await addresses.getAddressTxsChain({ address });
|
||||
console.log(addressTxsChain);
|
||||
|
||||
const addressTxsMempool = await addresses.getAddressTxsMempool({
|
||||
address,
|
||||
});
|
||||
console.log(addressTxsMempool);
|
||||
|
||||
const addressTxsUtxo = await addresses.getAddressTxsUtxo({ address });
|
||||
console.log(addressTxsUtxo);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,33 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { assets },
|
||||
} = mempoolJS();
|
||||
|
||||
const asset_id = '1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC';
|
||||
|
||||
const asset = await assets.getAsset({ asset_id });
|
||||
console.log(asset);
|
||||
|
||||
const assetTxs = await assets.getAssetTxs({
|
||||
asset_id,
|
||||
is_mempool: false,
|
||||
});
|
||||
console.log(assetTxs);
|
||||
|
||||
const assetSupply = await assets.getAssetSupply({
|
||||
asset_id,
|
||||
decimal: false,
|
||||
});
|
||||
console.log(assetSupply);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,49 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000015dc777b3ff2611091336355d3f0ee9766a2cf3be8e4b1ce';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const blockStatus = await blocks.getBlockStatus({ hash });
|
||||
console.log(blockStatus);
|
||||
|
||||
const blockTxs = await blocks.getBlockTxs({ hash });
|
||||
console.log(blockTxs);
|
||||
|
||||
const blockTxids = await blocks.getBlockTxids({ hash });
|
||||
console.log(blockTxids);
|
||||
|
||||
const blockTxid = await blocks.getBlockTxid({ hash, index: 218 });
|
||||
console.log(blockTxid);
|
||||
|
||||
const blockRaw = await blocks.getBlockRaw({ hash });
|
||||
console.log(blockRaw);
|
||||
|
||||
const blockHeight = await blocks.getBlockHeight({ height: 0 });
|
||||
console.log(blockHeight);
|
||||
|
||||
const getBlocks = await blocks.getBlocks({ start_height: 9999 });
|
||||
console.log(getBlocks);
|
||||
|
||||
const blocksTipHeight = await blocks.getBlocksTipHeight();
|
||||
console.log(blocksTipHeight);
|
||||
|
||||
const blocksTipHash = await blocks.getBlocksTipHash();
|
||||
console.log(blocksTipHash);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,22 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { fees },
|
||||
} = mempoolJS();
|
||||
|
||||
const feesRecommended = await fees.getFeesRecommended();
|
||||
console.log(feesRecommended);
|
||||
|
||||
const feesMempoolBlocks = await fees.getFeesMempoolBlocks();
|
||||
console.log(feesMempoolBlocks);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { mempool },
|
||||
} = mempoolJS();
|
||||
|
||||
const getMempool = await mempool.getMempool();
|
||||
console.log(getMempool);
|
||||
|
||||
const getMempoolRecent = await mempool.getMempoolRecent();
|
||||
console.log(getMempoolRecent);
|
||||
|
||||
const getMempoolTxids = await mempool.getMempoolTxids();
|
||||
console.log(getMempoolTxids);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,51 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid =
|
||||
'15e10745f15593a899cef391191bdd3d7c12412cc4696b7bcb669d0feadc8521';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txStatus = await transactions.getTxStatus({ txid });
|
||||
console.log(txStatus);
|
||||
|
||||
const txHex = await transactions.getTxHex({ txid });
|
||||
console.log(txHex);
|
||||
|
||||
const txRaw = await transactions.getTxRaw({ txid });
|
||||
console.log(txRaw);
|
||||
|
||||
const txMerkleBlockProof = await transactions.getTxMerkleBlockProof({
|
||||
txid,
|
||||
});
|
||||
console.log(txMerkleBlockProof);
|
||||
|
||||
const txMerkleProof = await transactions.getTxMerkleProof({ txid });
|
||||
console.log(txMerkleProof);
|
||||
|
||||
const txOutspend = await transactions.getTxOutspend({
|
||||
txid,
|
||||
vout: 3,
|
||||
});
|
||||
console.log(txOutspend);
|
||||
|
||||
const txOutspends = await transactions.getTxOutspends({ txid });
|
||||
console.log(txOutspends);
|
||||
|
||||
// const postTx = await transactions.postTx({ txid });
|
||||
// console.log(postTx);
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,36 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="https://mempool.space/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { websocket },
|
||||
} = mempoolJS();
|
||||
|
||||
const ws = websocket.initClient({
|
||||
options: ['blocks', 'stats', 'mempool-blocks', 'live-2h-chart'],
|
||||
});
|
||||
|
||||
ws.addEventListener('message', function incoming({data}) {
|
||||
const res = JSON.parse(data.toString());
|
||||
if (res.blocks) {
|
||||
console.log(res.blocks);
|
||||
}
|
||||
if (res.mempoolInfo) {
|
||||
console.log(res.mempoolInfo);
|
||||
}
|
||||
if (res.transactions) {
|
||||
console.log(res.transactions);
|
||||
}
|
||||
if (res.mempoolBlocks) {
|
||||
console.log(res.mempoolBlocks);
|
||||
}
|
||||
});
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
25
examples/html/mempool-js/bisq/addresses.html
Normal file
25
examples/html/mempool-js/bisq/addresses.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bisq: { addresses },
|
||||
} = mempoolJS();
|
||||
|
||||
const address = 'B1DgwRN92rdQ9xpEVCdXRfgeqGw9X4YtrZz';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
35
examples/html/mempool-js/bisq/blocks.html
Normal file
35
examples/html/mempool-js/bisq/blocks.html
Normal file
@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bisq: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000000079aa6bfa46eb8fc20474e8673d6e8a123b211236bf82d';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const myBlocks = await blocks.getBlocks({ index: 0, length: 1 });
|
||||
console.log(myBlocks);
|
||||
|
||||
const myBlocksHeight = await blocks.getBlocksTipHeight({
|
||||
index: 0,
|
||||
length: 1,
|
||||
});
|
||||
console.log(myBlocksHeight);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
23
examples/html/mempool-js/bisq/statistics.html
Normal file
23
examples/html/mempool-js/bisq/statistics.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bisq: { statistics },
|
||||
} = mempoolJS();
|
||||
|
||||
const stats = await statistics.getStats();
|
||||
console.log(stats);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
28
examples/html/mempool-js/bisq/transactions.html
Normal file
28
examples/html/mempool-js/bisq/transactions.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bisq: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid = 'e5a42c5eff51822eb0ab503cac0e0eadf2141089c83c9f8363210a004c6e66a7';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txs = await transactions.getTxs({ index: 0, length: 1 });
|
||||
console.log(txs);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
39
examples/html/mempool-js/bitcoin/addresses.html
Normal file
39
examples/html/mempool-js/bitcoin/addresses.html
Normal file
@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bitcoin: { addresses },
|
||||
} = mempoolJS();
|
||||
|
||||
const address = '1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
|
||||
const addressTxs = await addresses.getAddressTxs({ address });
|
||||
console.log(addressTxs);
|
||||
|
||||
const addressTxsChain = await addresses.getAddressTxsChain({ address });
|
||||
console.log(addressTxsChain);
|
||||
|
||||
const addressTxsMempool = await addresses.getAddressTxsMempool({
|
||||
address,
|
||||
});
|
||||
console.log(addressTxsMempool);
|
||||
|
||||
const addressTxsUtxo = await addresses.getAddressTxsUtxo({ address });
|
||||
console.log(addressTxsUtxo);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
56
examples/html/mempool-js/bitcoin/blocks.html
Normal file
56
examples/html/mempool-js/bitcoin/blocks.html
Normal file
@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bitcoin: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000015dc777b3ff2611091336355d3f0ee9766a2cf3be8e4b1ce';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const blockStatus = await blocks.getBlockStatus({ hash });
|
||||
console.log(blockStatus);
|
||||
|
||||
const blockTxs = await blocks.getBlockTxs({ hash });
|
||||
console.log(blockTxs);
|
||||
|
||||
const blockTxids = await blocks.getBlockTxids({ hash });
|
||||
console.log(blockTxids);
|
||||
|
||||
const blockTxid = await blocks.getBlockTxid({ hash, index: 218 });
|
||||
console.log(blockTxid);
|
||||
|
||||
const blockRaw = await blocks.getBlockRaw({ hash });
|
||||
console.log(blockRaw);
|
||||
|
||||
const blockHeader = await blocks.getBlockHeader({ hash });
|
||||
console.log(blockHeader);
|
||||
|
||||
const blockHeight = await blocks.getBlockHeight({ height: 0 });
|
||||
console.log(blockHeight);
|
||||
|
||||
const getBlocks = await blocks.getBlocks({ start_height: 9999 });
|
||||
console.log(getBlocks);
|
||||
|
||||
const blocksTipHeight = await blocks.getBlocksTipHeight();
|
||||
console.log(blocksTipHeight);
|
||||
|
||||
const blocksTipHash = await blocks.getBlocksTipHash();
|
||||
console.log(blocksTipHash);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
23
examples/html/mempool-js/bitcoin/difficulty.html
Normal file
23
examples/html/mempool-js/bitcoin/difficulty.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bitcoin: { difficulty },
|
||||
} = mempoolJS();
|
||||
|
||||
const difficultyAdjustment = await difficulty.getDifficultyAdjustment();
|
||||
console.log(difficultyAdjustment);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
26
examples/html/mempool-js/bitcoin/fees.html
Normal file
26
examples/html/mempool-js/bitcoin/fees.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bitcoin: { fees },
|
||||
} = mempoolJS();
|
||||
|
||||
const feesRecommended = await fees.getFeesRecommended();
|
||||
console.log(feesRecommended);
|
||||
|
||||
const feesMempoolBlocks = await fees.getFeesMempoolBlocks();
|
||||
console.log(feesMempoolBlocks);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
29
examples/html/mempool-js/bitcoin/mempool.html
Normal file
29
examples/html/mempool-js/bitcoin/mempool.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bitcoin: { mempool },
|
||||
} = mempoolJS();
|
||||
|
||||
const getMempool = await mempool.getMempool();
|
||||
console.log(getMempool);
|
||||
|
||||
const getMempoolRecent = await mempool.getMempoolRecent();
|
||||
console.log(getMempoolRecent);
|
||||
|
||||
const getMempoolTxids = await mempool.getMempoolTxids();
|
||||
console.log(getMempoolTxids);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
56
examples/html/mempool-js/bitcoin/transactions.html
Normal file
56
examples/html/mempool-js/bitcoin/transactions.html
Normal file
@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bitcoin: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid =
|
||||
'15e10745f15593a899cef391191bdd3d7c12412cc4696b7bcb669d0feadc8521';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txStatus = await transactions.getTxStatus({ txid });
|
||||
console.log(txStatus);
|
||||
|
||||
const txHex = await transactions.getTxHex({ txid });
|
||||
console.log(txHex);
|
||||
|
||||
const txRaw = await transactions.getTxRaw({ txid });
|
||||
console.log(txRaw);
|
||||
|
||||
const txMerkleBlockProof = await transactions.getTxMerkleBlockProof({
|
||||
txid,
|
||||
});
|
||||
console.log(txMerkleBlockProof);
|
||||
|
||||
const txMerkleProof = await transactions.getTxMerkleProof({ txid });
|
||||
console.log(txMerkleProof);
|
||||
|
||||
const txOutspend = await transactions.getTxOutspend({
|
||||
txid,
|
||||
vout: 3,
|
||||
});
|
||||
console.log(txOutspend);
|
||||
|
||||
const txOutspends = await transactions.getTxOutspends({ txid });
|
||||
console.log(txOutspends);
|
||||
|
||||
const postTx = await transactions.postTx({ txhex });
|
||||
console.log(postTx);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
|
||||
40
examples/html/mempool-js/bitcoin/websocket.html
Normal file
40
examples/html/mempool-js/bitcoin/websocket.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bitcoin: { websocket },
|
||||
} = mempoolJS();
|
||||
|
||||
const ws = websocket.initClient({
|
||||
options: ['blocks', 'stats', 'mempool-blocks', 'live-2h-chart'],
|
||||
});
|
||||
|
||||
ws.addEventListener('message', function incoming({data}) {
|
||||
const res = JSON.parse(data.toString());
|
||||
if (res.blocks) {
|
||||
console.log(res.blocks);
|
||||
}
|
||||
if (res.mempoolInfo) {
|
||||
console.log(res.mempoolInfo);
|
||||
}
|
||||
if (res.transactions) {
|
||||
console.log(res.transactions);
|
||||
}
|
||||
if (res.mempoolBlocks) {
|
||||
console.log(res.mempoolBlocks);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
39
examples/html/mempool-js/liquid/addresses.html
Normal file
39
examples/html/mempool-js/liquid/addresses.html
Normal file
@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { addresses },
|
||||
} = mempoolJS();
|
||||
|
||||
const address = 'Go65t19hP2FuhBMYtgbdMDgdmEzNwh1i48';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
|
||||
const addressTxs = await addresses.getAddressTxs({ address });
|
||||
console.log(addressTxs);
|
||||
|
||||
const addressTxsChain = await addresses.getAddressTxsChain({ address });
|
||||
console.log(addressTxsChain);
|
||||
|
||||
const addressTxsMempool = await addresses.getAddressTxsMempool({
|
||||
address,
|
||||
});
|
||||
console.log(addressTxsMempool);
|
||||
|
||||
const addressTxsUtxo = await addresses.getAddressTxsUtxo({ address });
|
||||
console.log(addressTxsUtxo);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
37
examples/html/mempool-js/liquid/assets.html
Normal file
37
examples/html/mempool-js/liquid/assets.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { assets },
|
||||
} = mempoolJS();
|
||||
|
||||
const asset_id = 'a0c358a0f6947864af3a06f3f6a2aeb304df7fd95c922f2f22d7412399ce7691';
|
||||
|
||||
const asset = await assets.getAsset({ asset_id });
|
||||
console.log(asset);
|
||||
|
||||
const assetTxs = await assets.getAssetTxs({
|
||||
asset_id,
|
||||
is_mempool: false,
|
||||
});
|
||||
console.log(assetTxs);
|
||||
|
||||
const assetSupply = await assets.getAssetSupply({
|
||||
asset_id,
|
||||
decimal: false,
|
||||
});
|
||||
console.log(assetSupply);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
53
examples/html/mempool-js/liquid/blocks.html
Normal file
53
examples/html/mempool-js/liquid/blocks.html
Normal file
@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'54f02bdec5509ea769c8be82aed51f689969b653d92a2812d5a36266cbfbc55e';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const blockStatus = await blocks.getBlockStatus({ hash });
|
||||
console.log(blockStatus);
|
||||
|
||||
const blockTxs = await blocks.getBlockTxs({ hash });
|
||||
console.log(blockTxs);
|
||||
|
||||
const blockTxids = await blocks.getBlockTxids({ hash });
|
||||
console.log(blockTxids);
|
||||
|
||||
const blockTxid = await blocks.getBlockTxid({ hash, index: 0 });
|
||||
console.log(blockTxid);
|
||||
|
||||
const blockRaw = await blocks.getBlockRaw({ hash });
|
||||
console.log(blockRaw);
|
||||
|
||||
const blockHeight = await blocks.getBlockHeight({ height: 0 });
|
||||
console.log(blockHeight);
|
||||
|
||||
const getBlocks = await blocks.getBlocks({ start_height: 9999 });
|
||||
console.log(getBlocks);
|
||||
|
||||
const blocksTipHeight = await blocks.getBlocksTipHeight();
|
||||
console.log(blocksTipHeight);
|
||||
|
||||
const blocksTipHash = await blocks.getBlocksTipHash();
|
||||
console.log(blocksTipHash);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
26
examples/html/mempool-js/liquid/fees.html
Normal file
26
examples/html/mempool-js/liquid/fees.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { fees },
|
||||
} = mempoolJS();
|
||||
|
||||
const feesRecommended = await fees.getFeesRecommended();
|
||||
console.log(feesRecommended);
|
||||
|
||||
const feesMempoolBlocks = await fees.getFeesMempoolBlocks();
|
||||
console.log(feesMempoolBlocks);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
29
examples/html/mempool-js/liquid/mempool.html
Normal file
29
examples/html/mempool-js/liquid/mempool.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { mempool },
|
||||
} = mempoolJS();
|
||||
|
||||
const getMempool = await mempool.getMempool();
|
||||
console.log(getMempool);
|
||||
|
||||
const getMempoolRecent = await mempool.getMempoolRecent();
|
||||
console.log(getMempoolRecent);
|
||||
|
||||
const getMempoolTxids = await mempool.getMempoolTxids();
|
||||
console.log(getMempoolTxids);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
55
examples/html/mempool-js/liquid/transactions.html
Normal file
55
examples/html/mempool-js/liquid/transactions.html
Normal file
@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid =
|
||||
'15e10745f15593a899cef391191bdd3d7c12412cc4696b7bcb669d0feadc8521';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txStatus = await transactions.getTxStatus({ txid });
|
||||
console.log(txStatus);
|
||||
|
||||
const txHex = await transactions.getTxHex({ txid });
|
||||
console.log(txHex);
|
||||
|
||||
const txRaw = await transactions.getTxRaw({ txid });
|
||||
console.log(txRaw);
|
||||
|
||||
const txMerkleBlockProof = await transactions.getTxMerkleBlockProof({
|
||||
txid,
|
||||
});
|
||||
console.log(txMerkleBlockProof);
|
||||
|
||||
const txMerkleProof = await transactions.getTxMerkleProof({ txid });
|
||||
console.log(txMerkleProof);
|
||||
|
||||
const txOutspend = await transactions.getTxOutspend({
|
||||
txid,
|
||||
vout: 3,
|
||||
});
|
||||
console.log(txOutspend);
|
||||
|
||||
const txOutspends = await transactions.getTxOutspends({ txid });
|
||||
console.log(txOutspends);
|
||||
|
||||
// const postTx = await transactions.postTx({ txhex });
|
||||
// console.log(postTx);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
40
examples/html/mempool-js/liquid/websocket.html
Normal file
40
examples/html/mempool-js/liquid/websocket.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
<script src="./../../../../dist/mempool.js"></script>
|
||||
<script>
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { websocket },
|
||||
} = mempoolJS();
|
||||
|
||||
const ws = websocket.initClient({
|
||||
options: ['blocks', 'stats', 'mempool-blocks', 'live-2h-chart'],
|
||||
});
|
||||
|
||||
ws.addEventListener('message', function incoming({data}) {
|
||||
const res = JSON.parse(data.toString());
|
||||
if (res.blocks) {
|
||||
console.log(res.blocks);
|
||||
}
|
||||
if (res.mempoolInfo) {
|
||||
console.log(res.mempoolInfo);
|
||||
}
|
||||
if (res.transactions) {
|
||||
console.log(res.transactions);
|
||||
}
|
||||
if (res.mempoolBlocks) {
|
||||
console.log(res.mempoolBlocks);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@ -1,9 +1,7 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
import bisqJS from "./../../../src/index-bisq";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
bisq: { addresses },
|
||||
} = mempoolJS();
|
||||
const { addresses } = bisqJS();
|
||||
|
||||
const address = 'B1DgwRN92rdQ9xpEVCdXRfgeqGw9X4YtrZz';
|
||||
|
||||
24
examples/nodejs/bisq-js/blocks.ts
Normal file
24
examples/nodejs/bisq-js/blocks.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import bisqJS from "./../../../src/index-bisq";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const { blocks } = bisqJS();
|
||||
|
||||
const hash = '000000000000000000079aa6bfa46eb8fc20474e8673d6e8a123b211236bf82d';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const myBlocks = await blocks.getBlocks({ index: 0, length: 1 });
|
||||
console.log(myBlocks);
|
||||
|
||||
const myBlocksHeight = await blocks.getBlocksTipHeight({
|
||||
index: 0,
|
||||
length: 1,
|
||||
});
|
||||
console.log(myBlocksHeight);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
38
examples/nodejs/bisq-js/markets.ts
Normal file
38
examples/nodejs/bisq-js/markets.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import bisqJS from "./../../../src/index-bisq";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const { markets } = bisqJS();
|
||||
|
||||
const market = "BTC_USD";
|
||||
const basecurrency = "BTC";
|
||||
|
||||
const allMarkets = await markets.getMarkets();
|
||||
console.log(allMarkets);
|
||||
|
||||
const currencies = await markets.getCurrencies();
|
||||
console.log(currencies);
|
||||
|
||||
const depth = await markets.getDepth({ market });
|
||||
console.log(depth)
|
||||
|
||||
const hloc = await markets.getHloc({ market });
|
||||
console.log(hloc);
|
||||
|
||||
const offers = await markets.getOffers({ market });
|
||||
console.log(offers);
|
||||
|
||||
const ticker = await markets.getTicker({ market });
|
||||
console.log(ticker);
|
||||
|
||||
const trades = await markets.getTrades({ market });
|
||||
console.log(trades);
|
||||
|
||||
const volumes = await markets.getVolumes({ basecurrency, market });
|
||||
console.log(volumes);
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
13
examples/nodejs/bisq-js/statistics.ts
Normal file
13
examples/nodejs/bisq-js/statistics.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import bisqJS from "./../../../src/index-bisq";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const { statistics } = bisqJS();
|
||||
|
||||
const stats = await statistics.getStats();
|
||||
console.log(stats);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
18
examples/nodejs/bisq-js/transactions.ts
Normal file
18
examples/nodejs/bisq-js/transactions.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import bisqJS from "./../../../src/index-bisq";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const { transactions } = bisqJS();
|
||||
|
||||
const txid = '4b5417ec5ab6112bedf539c3b4f5a806ed539542d8b717e1c4470aa3180edce5';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txs = await transactions.getTxs({ index: 0, length: 1 });
|
||||
console.log(txs);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
@ -1,23 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
bisq: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000000079aa6bfa46eb8fc20474e8673d6e8a123b211236bf82d';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const myBlocks = await blocks.getBlocks({ index: 0, length: 1 });
|
||||
console.log(myBlocks);
|
||||
|
||||
const myBlocksHeight = await blocks.getBlocksTipHeight({
|
||||
index: 0,
|
||||
length: 1,
|
||||
});
|
||||
console.log(myBlocksHeight);
|
||||
};
|
||||
init();
|
||||
@ -1,11 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
bisq: { statistics },
|
||||
} = mempoolJS();
|
||||
|
||||
const stats = await statistics.getStats();
|
||||
console.log(stats);
|
||||
};
|
||||
init();
|
||||
@ -1,17 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
bisq: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid =
|
||||
'4b5417ec5ab6112bedf539c3b4f5a806ed539542d8b717e1c4470aa3180edce5';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txs = await transactions.getTxs({ index: 0, length: 1 });
|
||||
console.log(txs);
|
||||
};
|
||||
init();
|
||||
@ -1,25 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { addresses },
|
||||
} = mempoolJS();
|
||||
|
||||
const address = '1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
|
||||
const addressTxs = await addresses.getAddressTxs({ address });
|
||||
console.log(addressTxs);
|
||||
|
||||
const addressTxsChain = await addresses.getAddressTxsChain({ address });
|
||||
console.log(addressTxsChain);
|
||||
|
||||
const addressTxsMempool = await addresses.getAddressTxsMempool({ address });
|
||||
console.log(addressTxsMempool);
|
||||
|
||||
const addressTxsUtxo = await addresses.getAddressTxsUtxo({ address });
|
||||
console.log(addressTxsUtxo);
|
||||
};
|
||||
init();
|
||||
@ -1,44 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000015dc777b3ff2611091336355d3f0ee9766a2cf3be8e4b1ce';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const blockStatus = await blocks.getBlockStatus({ hash });
|
||||
console.log(blockStatus);
|
||||
|
||||
const blockTxs = await blocks.getBlockTxs({ hash });
|
||||
console.log(blockTxs);
|
||||
|
||||
const blockTxids = await blocks.getBlockTxids({ hash });
|
||||
console.log(blockTxids);
|
||||
|
||||
const blockTxid = await blocks.getBlockTxid({ hash, index: 218 });
|
||||
console.log(blockTxid);
|
||||
|
||||
const blockRaw = await blocks.getBlockRaw({ hash });
|
||||
console.log(blockRaw);
|
||||
|
||||
const blockHeader = await blocks.getBlockHeader({ hash });
|
||||
console.log(blockHeader);
|
||||
|
||||
const blockHeight = await blocks.getBlockHeight({ height: 0 });
|
||||
console.log(blockHeight);
|
||||
|
||||
const getBlocks = await blocks.getBlocks({ start_height: 9999 });
|
||||
console.log(getBlocks);
|
||||
|
||||
const blocksTipHeight = await blocks.getBlocksTipHeight();
|
||||
console.log(blocksTipHeight);
|
||||
|
||||
const blocksTipHash = await blocks.getBlocksTipHash();
|
||||
console.log(blocksTipHash);
|
||||
};
|
||||
init();
|
||||
@ -1,11 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { difficulty },
|
||||
} = mempoolJS();
|
||||
|
||||
const difficultyAdjustment = await difficulty.getDifficultyAdjustment();
|
||||
console.log(difficultyAdjustment);
|
||||
};
|
||||
init();
|
||||
@ -1,19 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { fees },
|
||||
} = mempoolJS();
|
||||
|
||||
const feesRecommended = await fees.getFeesRecommended();
|
||||
console.log(feesRecommended);
|
||||
|
||||
const feesMempoolBlocks = await fees.getFeesMempoolBlocks();
|
||||
console.log(feesMempoolBlocks);
|
||||
|
||||
const txid = 'txid';
|
||||
|
||||
const feesCPFP = await fees.getCPFP({ txid });
|
||||
console.log(feesCPFP);
|
||||
};
|
||||
init();
|
||||
@ -1,17 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { mempool },
|
||||
} = mempoolJS();
|
||||
|
||||
const getMempool = await mempool.getMempool();
|
||||
console.log(getMempool);
|
||||
|
||||
const getMempoolRecent = await mempool.getMempoolRecent();
|
||||
console.log(getMempoolRecent);
|
||||
|
||||
const getMempoolTxids = await mempool.getMempoolTxids();
|
||||
console.log(getMempoolTxids);
|
||||
};
|
||||
init();
|
||||
@ -1,41 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
bitcoin: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid =
|
||||
'15e10745f15593a899cef391191bdd3d7c12412cc4696b7bcb669d0feadc8521';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txStatus = await transactions.getTxStatus({ txid });
|
||||
console.log(txStatus);
|
||||
|
||||
const txHex = await transactions.getTxHex({ txid });
|
||||
console.log(txHex);
|
||||
|
||||
const txRaw = await transactions.getTxRaw({ txid });
|
||||
console.log(txRaw);
|
||||
|
||||
const txMerkleBlockProof = await transactions.getTxMerkleBlockProof({ txid });
|
||||
console.log(txMerkleBlockProof);
|
||||
|
||||
const txMerkleProof = await transactions.getTxMerkleProof({ txid });
|
||||
console.log(txMerkleProof);
|
||||
|
||||
const txOutspend = await transactions.getTxOutspend({
|
||||
txid,
|
||||
vout: 3,
|
||||
});
|
||||
console.log(txOutspend);
|
||||
|
||||
const txOutspends = await transactions.getTxOutspends({ txid });
|
||||
console.log(txOutspends);
|
||||
|
||||
// const postTx = await transactions.postTx({ txid });
|
||||
// console.log(postTx);
|
||||
};
|
||||
init();
|
||||
@ -1,27 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const { bitcoin: { websocket } } = mempoolJS();
|
||||
|
||||
const init = async () => {
|
||||
|
||||
const ws = websocket.initServer({
|
||||
options: ["blocks", "stats", "mempool-blocks", "live-2h-chart"],
|
||||
});
|
||||
|
||||
ws.on("message", function incoming(data) {
|
||||
const res = JSON.parse(data.toString());
|
||||
if (res.blocks) {
|
||||
console.log(res.blocks);
|
||||
}
|
||||
if (res.mempoolInfo) {
|
||||
console.log(res.mempoolInfo);
|
||||
}
|
||||
if (res.transactions) {
|
||||
console.log(res.transactions);
|
||||
}
|
||||
if (res.mempoolBlocks) {
|
||||
console.log(res.mempoolBlocks);
|
||||
}
|
||||
});
|
||||
}
|
||||
init();
|
||||
@ -1,19 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const { bitcoin } = mempoolJS({
|
||||
hostname:'localhost:4200'
|
||||
});
|
||||
|
||||
const feesRecommended = await bitcoin.fees.getFeesRecommended();
|
||||
console.log(feesRecommended);
|
||||
|
||||
const hash = "0000000000000000000065bda8f8a88f2e1e00d9a6887a43d640e52a4c7660f2";
|
||||
const block = await bitcoin.blocks.getBlockHeader({hash});
|
||||
console.log(block);
|
||||
|
||||
const difficultyAdjustment = await bitcoin.difficulty.getDifficultyAdjustment();
|
||||
console.log(difficultyAdjustment);
|
||||
};
|
||||
|
||||
init();
|
||||
29
examples/nodejs/liquid-js/addresses.ts
Normal file
29
examples/nodejs/liquid-js/addresses.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import mempoolJS from "./../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { addresses },
|
||||
} = mempoolJS();
|
||||
|
||||
const address = '1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
|
||||
const addressTxs = await addresses.getAddressTxs({ address });
|
||||
console.log(addressTxs);
|
||||
|
||||
const addressTxsChain = await addresses.getAddressTxsChain({ address });
|
||||
console.log(addressTxsChain);
|
||||
|
||||
const addressTxsMempool = await addresses.getAddressTxsMempool({ address });
|
||||
console.log(addressTxsMempool);
|
||||
|
||||
const addressTxsUtxo = await addresses.getAddressTxsUtxo({ address });
|
||||
console.log(addressTxsUtxo);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
24
examples/nodejs/liquid-js/assets.ts
Normal file
24
examples/nodejs/liquid-js/assets.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import mempoolJS from "./../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { assets },
|
||||
} = mempoolJS();
|
||||
|
||||
const asset_id =
|
||||
'6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d';
|
||||
|
||||
const asset = await assets.getAsset({ asset_id });
|
||||
console.log(asset);
|
||||
|
||||
const assetTxs = await assets.getAssetTxs({ asset_id, is_mempool: false });
|
||||
console.log(assetTxs);
|
||||
|
||||
const assetSupply = await assets.getAssetSupply({ asset_id, decimal: false });
|
||||
console.log(assetSupply);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
45
examples/nodejs/liquid-js/blocks.ts
Normal file
45
examples/nodejs/liquid-js/blocks.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import mempoolJS from "./../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000015dc777b3ff2611091336355d3f0ee9766a2cf3be8e4b1ce';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const blockStatus = await blocks.getBlockStatus({ hash });
|
||||
console.log(blockStatus);
|
||||
|
||||
const blockTxs = await blocks.getBlockTxs({ hash });
|
||||
console.log(blockTxs);
|
||||
|
||||
const blockTxids = await blocks.getBlockTxids({ hash });
|
||||
console.log(blockTxids);
|
||||
|
||||
const blockTxid = await blocks.getBlockTxid({ hash, index: 218 });
|
||||
console.log(blockTxid);
|
||||
|
||||
const blockRaw = await blocks.getBlockRaw({ hash });
|
||||
console.log(blockRaw);
|
||||
|
||||
const blockHeight = await blocks.getBlockHeight({ height: 0 });
|
||||
console.log(blockHeight);
|
||||
|
||||
const getBlocks = await blocks.getBlocks({ start_height: 9999 });
|
||||
console.log(getBlocks);
|
||||
|
||||
const blocksTipHeight = await blocks.getBlocksTipHeight();
|
||||
console.log(blocksTipHeight);
|
||||
|
||||
const blocksTipHash = await blocks.getBlocksTipHash();
|
||||
console.log(blocksTipHash);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
18
examples/nodejs/liquid-js/fees.ts
Normal file
18
examples/nodejs/liquid-js/fees.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import mempoolJS from "./../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { fees },
|
||||
} = mempoolJS();
|
||||
|
||||
const feesRecommended = await fees.getFeesRecommended();
|
||||
console.log(feesRecommended);
|
||||
|
||||
const feesMempoolBlocks = await fees.getFeesMempoolBlocks();
|
||||
console.log(feesMempoolBlocks);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
21
examples/nodejs/liquid-js/mempool.ts
Normal file
21
examples/nodejs/liquid-js/mempool.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import mempoolJS from "./../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { mempool },
|
||||
} = mempoolJS();
|
||||
|
||||
const getMempool = await mempool.getMempool();
|
||||
console.log(getMempool);
|
||||
|
||||
const getMempoolRecent = await mempool.getMempoolRecent();
|
||||
console.log(getMempoolRecent);
|
||||
|
||||
const getMempoolTxids = await mempool.getMempoolTxids();
|
||||
console.log(getMempoolTxids);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
45
examples/nodejs/liquid-js/transactions.ts
Normal file
45
examples/nodejs/liquid-js/transactions.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import mempoolJS from "./../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid =
|
||||
'15e10745f15593a899cef391191bdd3d7c12412cc4696b7bcb669d0feadc8521';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txStatus = await transactions.getTxStatus({ txid });
|
||||
console.log(txStatus);
|
||||
|
||||
const txHex = await transactions.getTxHex({ txid });
|
||||
console.log(txHex);
|
||||
|
||||
const txRaw = await transactions.getTxRaw({ txid });
|
||||
console.log(txRaw);
|
||||
|
||||
const txMerkleBlockProof = await transactions.getTxMerkleBlockProof({ txid });
|
||||
console.log(txMerkleBlockProof);
|
||||
|
||||
const txMerkleProof = await transactions.getTxMerkleProof({ txid });
|
||||
console.log(txMerkleProof);
|
||||
|
||||
const txOutspend = await transactions.getTxOutspend({
|
||||
txid,
|
||||
vout: 3,
|
||||
});
|
||||
console.log(txOutspend);
|
||||
|
||||
const txOutspends = await transactions.getTxOutspends({ txid });
|
||||
console.log(txOutspends);
|
||||
|
||||
// const postTx = await transactions.postTx({ txhex });
|
||||
// console.log(postTx);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
30
examples/nodejs/liquid-js/websocket.ts
Normal file
30
examples/nodejs/liquid-js/websocket.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import mempoolJS from "./../../../src/index";
|
||||
|
||||
const { liquid: { websocket } } = mempoolJS();
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const ws = websocket.initServer({
|
||||
options: ["blocks", "stats", "mempool-blocks", "live-2h-chart"],
|
||||
});
|
||||
|
||||
ws.on("message", function incoming(data) {
|
||||
const res = JSON.parse(data.toString());
|
||||
if (res.blocks) {
|
||||
console.log(res.blocks);
|
||||
}
|
||||
if (res.mempoolInfo) {
|
||||
console.log(res.mempoolInfo);
|
||||
}
|
||||
if (res.transactions) {
|
||||
console.log(res.transactions);
|
||||
}
|
||||
if (res.mempoolBlocks) {
|
||||
console.log(res.mempoolBlocks);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
init();
|
||||
@ -1,25 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { addresses },
|
||||
} = mempoolJS();
|
||||
|
||||
const address = '1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
|
||||
const addressTxs = await addresses.getAddressTxs({ address });
|
||||
console.log(addressTxs);
|
||||
|
||||
const addressTxsChain = await addresses.getAddressTxsChain({ address });
|
||||
console.log(addressTxsChain);
|
||||
|
||||
const addressTxsMempool = await addresses.getAddressTxsMempool({ address });
|
||||
console.log(addressTxsMempool);
|
||||
|
||||
const addressTxsUtxo = await addresses.getAddressTxsUtxo({ address });
|
||||
console.log(addressTxsUtxo);
|
||||
};
|
||||
init();
|
||||
@ -1,20 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { assets },
|
||||
} = mempoolJS();
|
||||
|
||||
const asset_id =
|
||||
'6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d';
|
||||
|
||||
const asset = await assets.getAsset({ asset_id });
|
||||
console.log(asset);
|
||||
|
||||
const assetTxs = await assets.getAssetTxs({ asset_id, is_mempool: false });
|
||||
console.log(assetTxs);
|
||||
|
||||
const assetSupply = await assets.getAssetSupply({ asset_id, decimal: false });
|
||||
console.log(assetSupply);
|
||||
};
|
||||
init();
|
||||
@ -1,41 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000015dc777b3ff2611091336355d3f0ee9766a2cf3be8e4b1ce';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const blockStatus = await blocks.getBlockStatus({ hash });
|
||||
console.log(blockStatus);
|
||||
|
||||
const blockTxs = await blocks.getBlockTxs({ hash });
|
||||
console.log(blockTxs);
|
||||
|
||||
const blockTxids = await blocks.getBlockTxids({ hash });
|
||||
console.log(blockTxids);
|
||||
|
||||
const blockTxid = await blocks.getBlockTxid({ hash, index: 218 });
|
||||
console.log(blockTxid);
|
||||
|
||||
const blockRaw = await blocks.getBlockRaw({ hash });
|
||||
console.log(blockRaw);
|
||||
|
||||
const blockHeight = await blocks.getBlockHeight({ height: 0 });
|
||||
console.log(blockHeight);
|
||||
|
||||
const getBlocks = await blocks.getBlocks({ start_height: 9999 });
|
||||
console.log(getBlocks);
|
||||
|
||||
const blocksTipHeight = await blocks.getBlocksTipHeight();
|
||||
console.log(blocksTipHeight);
|
||||
|
||||
const blocksTipHash = await blocks.getBlocksTipHash();
|
||||
console.log(blocksTipHash);
|
||||
};
|
||||
init();
|
||||
@ -1,14 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { fees },
|
||||
} = mempoolJS();
|
||||
|
||||
const feesRecommended = await fees.getFeesRecommended();
|
||||
console.log(feesRecommended);
|
||||
|
||||
const feesMempoolBlocks = await fees.getFeesMempoolBlocks();
|
||||
console.log(feesMempoolBlocks);
|
||||
};
|
||||
init();
|
||||
@ -1,17 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { mempool },
|
||||
} = mempoolJS();
|
||||
|
||||
const getMempool = await mempool.getMempool();
|
||||
console.log(getMempool);
|
||||
|
||||
const getMempoolRecent = await mempool.getMempoolRecent();
|
||||
console.log(getMempoolRecent);
|
||||
|
||||
const getMempoolTxids = await mempool.getMempoolTxids();
|
||||
console.log(getMempoolTxids);
|
||||
};
|
||||
init();
|
||||
@ -1,41 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const init = async () => {
|
||||
const {
|
||||
liquid: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid =
|
||||
'15e10745f15593a899cef391191bdd3d7c12412cc4696b7bcb669d0feadc8521';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txStatus = await transactions.getTxStatus({ txid });
|
||||
console.log(txStatus);
|
||||
|
||||
const txHex = await transactions.getTxHex({ txid });
|
||||
console.log(txHex);
|
||||
|
||||
const txRaw = await transactions.getTxRaw({ txid });
|
||||
console.log(txRaw);
|
||||
|
||||
const txMerkleBlockProof = await transactions.getTxMerkleBlockProof({ txid });
|
||||
console.log(txMerkleBlockProof);
|
||||
|
||||
const txMerkleProof = await transactions.getTxMerkleProof({ txid });
|
||||
console.log(txMerkleProof);
|
||||
|
||||
const txOutspend = await transactions.getTxOutspend({
|
||||
txid,
|
||||
vout: 3,
|
||||
});
|
||||
console.log(txOutspend);
|
||||
|
||||
const txOutspends = await transactions.getTxOutspends({ txid });
|
||||
console.log(txOutspends);
|
||||
|
||||
// const postTx = await transactions.postTx({ txid });
|
||||
// console.log(postTx);
|
||||
};
|
||||
init();
|
||||
@ -1,27 +0,0 @@
|
||||
import mempoolJS from "@mempool/mempool.js";
|
||||
|
||||
const { liquid: { websocket } } = mempoolJS();
|
||||
|
||||
const init = async () => {
|
||||
|
||||
const ws = websocket.initServer({
|
||||
options: ["blocks", "stats", "mempool-blocks", "live-2h-chart"],
|
||||
});
|
||||
|
||||
ws.on("message", function incoming(data) {
|
||||
const res = JSON.parse(data.toString());
|
||||
if (res.blocks) {
|
||||
console.log(res.blocks);
|
||||
}
|
||||
if (res.mempoolInfo) {
|
||||
console.log(res.mempoolInfo);
|
||||
}
|
||||
if (res.transactions) {
|
||||
console.log(res.transactions);
|
||||
}
|
||||
if (res.mempoolBlocks) {
|
||||
console.log(res.mempoolBlocks);
|
||||
}
|
||||
});
|
||||
}
|
||||
init();
|
||||
17
examples/nodejs/mempool-js/bisq/addresses.ts
Normal file
17
examples/nodejs/mempool-js/bisq/addresses.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bisq: { addresses },
|
||||
} = mempoolJS();
|
||||
|
||||
const address = 'B1DgwRN92rdQ9xpEVCdXRfgeqGw9X4YtrZz';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
27
examples/nodejs/mempool-js/bisq/blocks.ts
Normal file
27
examples/nodejs/mempool-js/bisq/blocks.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bisq: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000000079aa6bfa46eb8fc20474e8673d6e8a123b211236bf82d';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const myBlocks = await blocks.getBlocks({ index: 0, length: 1 });
|
||||
console.log(myBlocks);
|
||||
|
||||
const myBlocksHeight = await blocks.getBlocksTipHeight({
|
||||
index: 0,
|
||||
length: 1,
|
||||
});
|
||||
console.log(myBlocksHeight);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
40
examples/nodejs/mempool-js/bisq/markets.ts
Normal file
40
examples/nodejs/mempool-js/bisq/markets.ts
Normal file
@ -0,0 +1,40 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bisq: { markets },
|
||||
} = mempoolJS();
|
||||
|
||||
const market = "BTC_USD";
|
||||
const basecurrency = "BTC";
|
||||
|
||||
const allMarkets = await markets.getMarkets();
|
||||
console.log(allMarkets);
|
||||
|
||||
const currencies = await markets.getCurrencies();
|
||||
console.log(currencies);
|
||||
|
||||
const depth = await markets.getDepth({ market });
|
||||
console.log(depth)
|
||||
|
||||
const hloc = await markets.getHloc({ market });
|
||||
console.log(hloc);
|
||||
|
||||
const offers = await markets.getOffers({ market });
|
||||
console.log(offers);
|
||||
|
||||
const ticker = await markets.getTicker({ market });
|
||||
console.log(ticker);
|
||||
|
||||
const trades = await markets.getTrades({ market });
|
||||
console.log(trades);
|
||||
|
||||
const volumes = await markets.getVolumes({ basecurrency, market });
|
||||
console.log(volumes);
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
15
examples/nodejs/mempool-js/bisq/statistics.ts
Normal file
15
examples/nodejs/mempool-js/bisq/statistics.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bisq: { statistics },
|
||||
} = mempoolJS();
|
||||
|
||||
const stats = await statistics.getStats();
|
||||
console.log(stats);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
21
examples/nodejs/mempool-js/bisq/transactions.ts
Normal file
21
examples/nodejs/mempool-js/bisq/transactions.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bisq: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid =
|
||||
'4b5417ec5ab6112bedf539c3b4f5a806ed539542d8b717e1c4470aa3180edce5';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txs = await transactions.getTxs({ index: 0, length: 1 });
|
||||
console.log(txs);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
27
examples/nodejs/mempool-js/bitcoin/addresses.ts
Normal file
27
examples/nodejs/mempool-js/bitcoin/addresses.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const { bitcoin: { addresses } } = mempoolJS();
|
||||
|
||||
const address = '1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
|
||||
const addressTxs = await addresses.getAddressTxs({ address });
|
||||
console.log(addressTxs);
|
||||
|
||||
const addressTxsChain = await addresses.getAddressTxsChain({ address });
|
||||
console.log(addressTxsChain);
|
||||
|
||||
const addressTxsMempool = await addresses.getAddressTxsMempool({ address });
|
||||
console.log(addressTxsMempool);
|
||||
|
||||
const addressTxsUtxo = await addresses.getAddressTxsUtxo({ address });
|
||||
console.log(addressTxsUtxo);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
49
examples/nodejs/mempool-js/bitcoin/blocks.ts
Normal file
49
examples/nodejs/mempool-js/bitcoin/blocks.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bitcoin: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000015dc777b3ff2611091336355d3f0ee9766a2cf3be8e4b1ce';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const blockStatus = await blocks.getBlockStatus({ hash });
|
||||
console.log(blockStatus);
|
||||
|
||||
const blockTxs = await blocks.getBlockTxs({ hash });
|
||||
console.log(blockTxs);
|
||||
|
||||
const blockTxids = await blocks.getBlockTxids({ hash });
|
||||
console.log(blockTxids);
|
||||
|
||||
const blockTxid = await blocks.getBlockTxid({ hash, index: 218 });
|
||||
console.log(blockTxid);
|
||||
|
||||
const blockRaw = await blocks.getBlockRaw({ hash });
|
||||
console.log(blockRaw);
|
||||
|
||||
const blockHeader = await blocks.getBlockHeader({ hash });
|
||||
console.log(blockHeader);
|
||||
|
||||
const blockHeight = await blocks.getBlockHeight({ height: 0 });
|
||||
console.log(blockHeight);
|
||||
|
||||
const getBlocks = await blocks.getBlocks({ start_height: 9999 });
|
||||
console.log(getBlocks);
|
||||
|
||||
const blocksTipHeight = await blocks.getBlocksTipHeight();
|
||||
console.log(blocksTipHeight);
|
||||
|
||||
const blocksTipHash = await blocks.getBlocksTipHash();
|
||||
console.log(blocksTipHash);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
|
||||
15
examples/nodejs/mempool-js/bitcoin/difficulty.ts
Normal file
15
examples/nodejs/mempool-js/bitcoin/difficulty.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bitcoin: { difficulty },
|
||||
} = mempoolJS();
|
||||
|
||||
const difficultyAdjustment = await difficulty.getDifficultyAdjustment();
|
||||
console.log(difficultyAdjustment);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
23
examples/nodejs/mempool-js/bitcoin/fees.ts
Normal file
23
examples/nodejs/mempool-js/bitcoin/fees.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bitcoin: { fees },
|
||||
} = mempoolJS();
|
||||
|
||||
const feesRecommended = await fees.getFeesRecommended();
|
||||
console.log(feesRecommended);
|
||||
|
||||
const feesMempoolBlocks = await fees.getFeesMempoolBlocks();
|
||||
console.log(feesMempoolBlocks);
|
||||
|
||||
const txid = 'txid';
|
||||
|
||||
const feesCPFP = await fees.getCPFP({ txid });
|
||||
console.log(feesCPFP);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
21
examples/nodejs/mempool-js/bitcoin/mempool.ts
Normal file
21
examples/nodejs/mempool-js/bitcoin/mempool.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bitcoin: { mempool },
|
||||
} = mempoolJS();
|
||||
|
||||
const getMempool = await mempool.getMempool();
|
||||
console.log(getMempool);
|
||||
|
||||
const getMempoolRecent = await mempool.getMempoolRecent();
|
||||
console.log(getMempoolRecent);
|
||||
|
||||
const getMempoolTxids = await mempool.getMempoolTxids();
|
||||
console.log(getMempoolTxids);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
45
examples/nodejs/mempool-js/bitcoin/transactions.ts
Normal file
45
examples/nodejs/mempool-js/bitcoin/transactions.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
bitcoin: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid =
|
||||
'15e10745f15593a899cef391191bdd3d7c12412cc4696b7bcb669d0feadc8521';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txStatus = await transactions.getTxStatus({ txid });
|
||||
console.log(txStatus);
|
||||
|
||||
const txHex = await transactions.getTxHex({ txid });
|
||||
console.log(txHex);
|
||||
|
||||
const txRaw = await transactions.getTxRaw({ txid });
|
||||
console.log(txRaw);
|
||||
|
||||
const txMerkleBlockProof = await transactions.getTxMerkleBlockProof({ txid });
|
||||
console.log(txMerkleBlockProof);
|
||||
|
||||
const txMerkleProof = await transactions.getTxMerkleProof({ txid });
|
||||
console.log(txMerkleProof);
|
||||
|
||||
const txOutspend = await transactions.getTxOutspend({
|
||||
txid,
|
||||
vout: 3,
|
||||
});
|
||||
console.log(txOutspend);
|
||||
|
||||
const txOutspends = await transactions.getTxOutspends({ txid });
|
||||
console.log(txOutspends);
|
||||
|
||||
// const postTx = await transactions.postTx({ txhex });
|
||||
// console.log(postTx);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
30
examples/nodejs/mempool-js/bitcoin/websocket.ts
Normal file
30
examples/nodejs/mempool-js/bitcoin/websocket.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const { bitcoin: { websocket } } = mempoolJS();
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const ws = websocket.initServer({
|
||||
options: ["blocks", "stats", "mempool-blocks", "live-2h-chart"],
|
||||
});
|
||||
|
||||
ws.on("message", function incoming(data) {
|
||||
const res = JSON.parse(data.toString());
|
||||
if (res.blocks) {
|
||||
console.log(res.blocks);
|
||||
}
|
||||
if (res.mempoolInfo) {
|
||||
console.log(res.mempoolInfo);
|
||||
}
|
||||
if (res.transactions) {
|
||||
console.log(res.transactions);
|
||||
}
|
||||
if (res.mempoolBlocks) {
|
||||
console.log(res.mempoolBlocks);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
init();
|
||||
29
examples/nodejs/mempool-js/liquid/addresses.ts
Normal file
29
examples/nodejs/mempool-js/liquid/addresses.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { addresses },
|
||||
} = mempoolJS();
|
||||
|
||||
const address = '1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
|
||||
const addressTxs = await addresses.getAddressTxs({ address });
|
||||
console.log(addressTxs);
|
||||
|
||||
const addressTxsChain = await addresses.getAddressTxsChain({ address });
|
||||
console.log(addressTxsChain);
|
||||
|
||||
const addressTxsMempool = await addresses.getAddressTxsMempool({ address });
|
||||
console.log(addressTxsMempool);
|
||||
|
||||
const addressTxsUtxo = await addresses.getAddressTxsUtxo({ address });
|
||||
console.log(addressTxsUtxo);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
24
examples/nodejs/mempool-js/liquid/assets.ts
Normal file
24
examples/nodejs/mempool-js/liquid/assets.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { assets },
|
||||
} = mempoolJS();
|
||||
|
||||
const asset_id =
|
||||
'6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d';
|
||||
|
||||
const asset = await assets.getAsset({ asset_id });
|
||||
console.log(asset);
|
||||
|
||||
const assetTxs = await assets.getAssetTxs({ asset_id, is_mempool: false });
|
||||
console.log(assetTxs);
|
||||
|
||||
const assetSupply = await assets.getAssetSupply({ asset_id, decimal: false });
|
||||
console.log(assetSupply);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
45
examples/nodejs/mempool-js/liquid/blocks.ts
Normal file
45
examples/nodejs/mempool-js/liquid/blocks.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { blocks },
|
||||
} = mempoolJS();
|
||||
|
||||
const hash =
|
||||
'000000000000000015dc777b3ff2611091336355d3f0ee9766a2cf3be8e4b1ce';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const blockStatus = await blocks.getBlockStatus({ hash });
|
||||
console.log(blockStatus);
|
||||
|
||||
const blockTxs = await blocks.getBlockTxs({ hash });
|
||||
console.log(blockTxs);
|
||||
|
||||
const blockTxids = await blocks.getBlockTxids({ hash });
|
||||
console.log(blockTxids);
|
||||
|
||||
const blockTxid = await blocks.getBlockTxid({ hash, index: 218 });
|
||||
console.log(blockTxid);
|
||||
|
||||
const blockRaw = await blocks.getBlockRaw({ hash });
|
||||
console.log(blockRaw);
|
||||
|
||||
const blockHeight = await blocks.getBlockHeight({ height: 0 });
|
||||
console.log(blockHeight);
|
||||
|
||||
const getBlocks = await blocks.getBlocks({ start_height: 9999 });
|
||||
console.log(getBlocks);
|
||||
|
||||
const blocksTipHeight = await blocks.getBlocksTipHeight();
|
||||
console.log(blocksTipHeight);
|
||||
|
||||
const blocksTipHash = await blocks.getBlocksTipHash();
|
||||
console.log(blocksTipHash);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
18
examples/nodejs/mempool-js/liquid/fees.ts
Normal file
18
examples/nodejs/mempool-js/liquid/fees.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { fees },
|
||||
} = mempoolJS();
|
||||
|
||||
const feesRecommended = await fees.getFeesRecommended();
|
||||
console.log(feesRecommended);
|
||||
|
||||
const feesMempoolBlocks = await fees.getFeesMempoolBlocks();
|
||||
console.log(feesMempoolBlocks);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
21
examples/nodejs/mempool-js/liquid/mempool.ts
Normal file
21
examples/nodejs/mempool-js/liquid/mempool.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { mempool },
|
||||
} = mempoolJS();
|
||||
|
||||
const getMempool = await mempool.getMempool();
|
||||
console.log(getMempool);
|
||||
|
||||
const getMempoolRecent = await mempool.getMempoolRecent();
|
||||
console.log(getMempoolRecent);
|
||||
|
||||
const getMempoolTxids = await mempool.getMempoolTxids();
|
||||
console.log(getMempoolTxids);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
45
examples/nodejs/mempool-js/liquid/transactions.ts
Normal file
45
examples/nodejs/mempool-js/liquid/transactions.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const {
|
||||
liquid: { transactions },
|
||||
} = mempoolJS();
|
||||
|
||||
const txid =
|
||||
'15e10745f15593a899cef391191bdd3d7c12412cc4696b7bcb669d0feadc8521';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txStatus = await transactions.getTxStatus({ txid });
|
||||
console.log(txStatus);
|
||||
|
||||
const txHex = await transactions.getTxHex({ txid });
|
||||
console.log(txHex);
|
||||
|
||||
const txRaw = await transactions.getTxRaw({ txid });
|
||||
console.log(txRaw);
|
||||
|
||||
const txMerkleBlockProof = await transactions.getTxMerkleBlockProof({ txid });
|
||||
console.log(txMerkleBlockProof);
|
||||
|
||||
const txMerkleProof = await transactions.getTxMerkleProof({ txid });
|
||||
console.log(txMerkleProof);
|
||||
|
||||
const txOutspend = await transactions.getTxOutspend({
|
||||
txid,
|
||||
vout: 3,
|
||||
});
|
||||
console.log(txOutspend);
|
||||
|
||||
const txOutspends = await transactions.getTxOutspends({ txid });
|
||||
console.log(txOutspends);
|
||||
|
||||
// const postTx = await transactions.postTx({ txhex });
|
||||
// console.log(postTx);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
30
examples/nodejs/mempool-js/liquid/websocket.ts
Normal file
30
examples/nodejs/mempool-js/liquid/websocket.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import mempoolJS from "./../../../../src/index";
|
||||
|
||||
const { liquid: { websocket } } = mempoolJS();
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const ws = websocket.initServer({
|
||||
options: ["blocks", "stats", "mempool-blocks", "live-2h-chart"],
|
||||
});
|
||||
|
||||
ws.on("message", function incoming(data) {
|
||||
const res = JSON.parse(data.toString());
|
||||
if (res.blocks) {
|
||||
console.log(res.blocks);
|
||||
}
|
||||
if (res.mempoolInfo) {
|
||||
console.log(res.mempoolInfo);
|
||||
}
|
||||
if (res.transactions) {
|
||||
console.log(res.transactions);
|
||||
}
|
||||
if (res.mempoolBlocks) {
|
||||
console.log(res.mempoolBlocks);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
init();
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"watch": ["src"],
|
||||
"watch": ["src", "examples"],
|
||||
"ext": "ts,json",
|
||||
"ignore": ["src/**/*.spec.ts"],
|
||||
"exec": "ts-node ./src/index.ts"
|
||||
|
||||
6
npm-bisq-js/.gitignore
vendored
Normal file
6
npm-bisq-js/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/node_modules
|
||||
/lib
|
||||
/dist/*
|
||||
!.gitkeep
|
||||
|
||||
yarn-error.log
|
||||
1
npm-bisq-js/README.md
Normal file
1
npm-bisq-js/README.md
Normal file
@ -0,0 +1 @@
|
||||
# Bisq JS API
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user