Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
The best way to interact with the weave, without having to write any GQL and trying to remember param names!
The best way to interact with the weave, without having to write any GQL and trying to remember param names!
ArDB is well typed and with the basic functions anyone will need to run and execute any request.
Plus, coming soon, we are planing to release an easy way to add or update data to Arwaeve right from ArDB!
First you'll need to add ardb to your project:
yarn add ardb
Import it into your project file:
import ArDB from 'ardb';
And now we are ready to play with it!
Examples:
// Get a single transaction
const tx = await ardb.search('transaction').id('A235HBk5p4nEWfjBEGsAo56kYsmq7mCCyc5UZq5sgjY').findOne();
// Get an array of transactions, in this case it will be of length 1 since
// we asked to find only 1.
const txs = await ardb.search('transactions').appName('SmartWeaveAction').findOne();
// This is the same as doing:
const txs = await ardb.search('transactions').tag('App-Name', 'SmartWeaveAction').limit(1).find();
// Search for multiple transactions
const txs = await ardb.search('transactions').from('BPr7vrFduuQqqVMu_tftxsScTKUq9ke0rx4q5C9ieQU').find();
// You can then keep going and searching for more by doing:
const newTxs = await ardb.next();
// Or you could get everything at once by doing:
const txs = await ardb.search('blocks').id('BkJ_h-GGIwfek-cJd-RaJrOXezAc0PmklItzzCLIF_aSk36FEjpOBuBDS27D2K_T').findAll();
search(type: 'transaction' | 'transactions' | 'block' | 'blocks' = 'transactions')
search()
before any other method.transactions
.id(id: string)
ids(ids: string[])
block
or transaction
, and you set ids(['TXID'])
, the first ID in the array will be selected as the search value.appName(name: string)
App-Name
tag and set it's value to name
.tag('App-Name', name)
or find({tags: [{name: 'App-Name', values: [name]}]})
but much shorter.type(type: string)
Content-Type
tag and set it's value to type
.tags(tags: {name: string, values: string[]})
tags([{name: 'app', values: ['myval']}, {name: 'date', values: ['yesterday', 'today']}])
.tag(name: string, values: string|string[])
tag('app', 'myval')
or tag('date', ['yesterday', 'today'])
.from(owners: string|string[])
to(recipients: string|string[])
min(min: number)
max(max: number)
limit(limit: number)
limit
. Default is 10
.sort(sort: 'HEIGHT_DESC' | 'HEIGHT_ASC')
desc
or asc
based on the block height.HEIGHT_DESC
.cursor(cursor: string)
transactions
or blocks
at a certain cursor, you can use the cursor()
method to set it before doing the request.After we complete our request with the previous methods, we can go ahead and find the items.
findOne(options: GlobalOptions = {})
transactions
and blocks
it set the limit to 1
automatically, even if a limit()
was set.find(options: GlobalOptions = {})
limit()
, if not set, limit is at the default 10
.findAll(options: GlobalOptions = {})
next()
find()
.run(query: string)
runAll(query: string)
export interface IBlock {
id?: string;
timestamp?: number;
height?: number;
previous?: string;
}
export interface IBlockFilter {
min?: number;
max?: number;
}
export interface ITransactionOptions {
id?: string;
}
export interface ITransactionsOptions {
ids?: string[];
owners?: string[];
recipients?: string[];
tags?: { name: string; values: string[] }[];
block?: IBlockFilter;
first?: number;
after?: string;
sort?: 'HEIGHT_DESC' | 'HEIGHT_ASC';
}
export interface IBlockOptions {
id?: string;
}
export interface IBlocksOptions {
id?: string;
height?: IBlockFilter;
after?: string;
sort?: 'HEIGHT_DESC' | 'HEIGHT_ASC';
}
export interface IGlobalOptions extends ITransactionOptions, ITransactionsOptions, IBlockOptions, IBlocksOptions {}
export type AmountType = string | { winston?: string; ar?: string }; // string = ar
export type OwnerType = string | { address?: string; key?: string }; // string = address
export type DataType = string | { size: string; type: string }; // string = type
export type RequestType = 'transaction' | 'block' | 'transactions' | 'blocks';
FAQs
The best way to interact with the weave, without having to write any GQL and trying to remember param names!
The npm package ardb receives a total of 226 weekly downloads. As such, ardb popularity was classified as not popular.
We found that ardb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.