
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
blockstream-js-client
Advanced tools
Find the Documentation for the Blockstream Satellite API here
npm install blockstream-js-client
Based on the node environment, this package will shuttle between the main network or the test network.
const B = require('blockstream-js-client');
// Create an Order on the main or test blockstream network
const { auth_token, uuid } = await B.createOrder({
bid: '10000', // Amount in millisatoshi
message: `Paschal's bid for a Tesla`,
});
// Edit Bid
B.increaseBid({
bid_increase: '4000',
auth_token,
uuid,
})
.then((res) => console.log({ res }))
.catch((error) => console.error(error));
// Monitor the status of the order / Get order
B.getOrder({
auth_token,
uuid,
})
.then((res) => console.log({ res }))
.catch((error) => console.error(error));
// Delete Order
B.deleteOrder({
auth_token,
uuid,
})
.then((res) => console.log({ res }))
.catch((error) => console.error(error));
// Get pending, sent and queued orders
B.getOrders({
state: 'pending',
})
.then((res) => console.log({ res }))
.catch((error) => console.error(error));
// Get information about the c-lightning node API
B.getInfo()
.then((res) => console.log({ res }))
.catch((error) => console.error(error));
// Subscribe to channels (The only available channel now is the "transmissions" channel)
B.subscribeToChannels(['transmissions'])
.then((res) => console.log({ res }))
.catch((error) => console.error(error));
This uses some TS definitions.
| means OR
? means OPTIONAL
createOrder
: Create an Order on the main or test blockstream network
Usage: createOrder({bid : string, file? : string, message?: string})
bid: Amount in millisatoshi. Required.
file: Link to an attachment. Optional.
message: Message to describe the order. Optional.
Returns:
// Success
{
error?: false;
auth_token: string;
uuid: string;
lightning_invoice_id: string;
description: string;
status: string;
msatoshi: string | number;
payreq: string;
expires_at: number;
created_at: number;
metadata: object;
}
// Error
{
error?: true;
message: string;
}
increaseBid
: Increase the bid for a particular order
Usage: increaseBid({auth_token : string, uuid : string, bid_increase : string
})
auth_token: Authentication token. Required.
uuid: Universally unique identifier. Required.
bid_increase: Amount to increase bid by, Millisatoshi. Required.
Returns:
// Success
{
error?: false;
auth_token: string;
uuid: string;
lightning_invoice_id: string;
description: string;
status: string;
msatoshi: string | number;
payreq: string;
expires_at: number;
created_at: number;
metadata: object;
}
// Error
{
error?: true;
message: string;
}
getOrder
: Fetch the details of a particular order
Usage: getOrder({uuid: string, auth_token: string})
uuid: Required.
auth_token: Required.
Returns:
//Success
{
error?: false;
bid: number | string;
message_digest: string;
status: string;
uuid: string;
created_at: Date;
started_transmission_at: Date;
ended_transmission_at: Date;
tx_seq_num: string;
unpaid_bid: number | string;
}
// Error
{
error?: true;
message: string;
}
getOrders
: Get orders that have either been sent, pending or queued.
Usage: getOrders({state: string, limit?: number, before?: string})
state: 'pending' | 'sent' | 'queued'. Required.
limit: Limit length of response. Optional. Defaults to 20.
before: The date to query with. Optional.
Returns:
//Success
{
error?: false,
data: [{
error?: false;
bid: number | string;
message_digest: string;
status: string;
uuid: string;
created_at: Date;
started_transmission_at: Date;
ended_transmission_at: Date;
tx_seq_num: string;
unpaid_bid: number | string;
}],
};
// Error
{
error?: true;
message: string;
}
deleteOrder
: Delete a Particular Order
Usage: deleteOrder({uuid: string, auth_token: string})
uuid: Required.
auth_token: Required.
Returns:
//Success
{
error?: false,
message: string,
}
// Error
{
error?: true;
message: string;
}
getInfo
: Get information about the c-lightning node.
Usage: getInfo()
Returns:
//Success
{
error: false;
id: string;
alias: string;
color: string;
number_of_peers: string | number;
number_of_active_channels: string | number;
number_of_inactive_channels: string | number;
number_of_pending_channels: string | number;
binding: Array<object>;
msatoshi_fees_collected: string | number;
fees_collected_msat: string;
lightning_directory: string;
address: Array<object>;
version: string;
blockheight: string | number;
network: string;
}
// Error
{
error?: true;
message: string;
}
subscribeToChannels
: Subscribe to server-sent event channels. The only channel available now, is the transmissions channel.
Usage: subscribeToChannels(channels: Array)
channels: Array of channels. Required.
Returns:
//Success
{
error?: false,
message: string,
}
// Error
{
error?: true;
message: string;
}
FAQs
The implementation of the Blockstream Satellite API
The npm package blockstream-js-client receives a total of 4 weekly downloads. As such, blockstream-js-client popularity was classified as not popular.
We found that blockstream-js-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.