
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@bandprotocol/bandchain.js
Advanced tools
Library for interacting with BandChain in browser and Node.js environments
Library for interacting with BandChain in browser and Node.js environments
npm install --save @bandprotocol/bandchain.js
const BandChain = require('@bandprotocol/bandchain.js')
const endpoint = 'http://guanyu-devnet.bandchain.org/rest'
const bandchain = new BandChain(endpoint)
...
npm run test
const BandChain = require('@bandprotocol/bandchain.js')
const endpoint = 'http://guanyu-devnet.bandchain.org/rest'
// Instantiating BandChain with REST endpoint
const bandchain = new BandChain(endpoint)
// Create an instance of OracleScript with the script ID
const oracleScript = await bandchain.getOracleScript(1)
// Get script info
const schema = oracleScript.schema
const description = oracleScript.description
// Read latest script result
const result = await bandchain.getLatestRequestResult(oracleScript, {
symbol: 'BTC',
multiplier: 10000,
})
// Create a new request, which will block into the tx is confirmed
try {
const minCount = 5
const askCount = 7
const mnemonic =
'dumb spot lyrics car infant round rate famous inhale tennis text current'
const requestId = await bandchain.submitRequestTx(
oracleScript,
{ symbol: 'BTC', multiplier: 10000 },
{ minCount, askCount },
mnemonic,
)
// Get request proof
const requestProof = await bandchain.getRequestProof(requestID)
// Get final result (blocking until the reports & aggregations are finished)
const finalResult = await bandchain.getRequestResult(requestID)
// Get the result of the most recent request that match the specified parameters
const minCount = 2
const askCount = 4
const inputParameters = { symbol: 'BTC', multiplier: BigInt('1000000000') }
const lastMatchResult = await bandchain.getLastMatchingRequestResult(
oracleScript,
inputParameters,
{ minCount, askCount },
)
} catch {
// Something went wrong
console.error('Data request failed')
}
FAQs
TypeScript library for Cosmos SDK and BandChain
We found that @bandprotocol/bandchain.js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.