
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
@kadena/client-utils
Advanced tools
Utility functions build as a wrapper around @kadena/client
Introducing @kadena/client-utils
, a library that aims to provide a
higher-level API for interacting with smart contracts. The library includes
helpers for the coin
module, which can be imported using
@kadena/client-utils/coin
. The library also exports utilities under /core
for smart contract developers to develop APIs, including some functions that can
be used for any kind of smart contracts.
Find a minimal interactive example at CodeSandbox
examples
import { getBalance, transferCrossChain } from "@kadena/client-utils/coin"
import { signWithChainweaver } from "@kadena/client"
const balance = await getBalance(
accountOne.account,
'development',
'0',
'http://localhost:8080',
);
const result = await createAccount(
{
account: 'javad',
keyset: {
pred: 'keys-all',
keys: ['key-a', 'key-b'],
},
gasPayer: { account: 'gasPayer', publicKeys: [''] },
chainId: '0',
},
{
host: 'https://api.testnet.chainweb.com',
defaults: {
networkId: 'testnet04',
},
sign: signWithChainweaver,
},
)
// signed Tx
.on('sign', (data) => console.log(data))
// preflight result
.on('preflight', (data) => console.log(data))
// submit result
.on('submit', (data) => console.log(data))
// listen result
.on('listen', (data) => console.log(data))
.execute();
This module also provides tools for estimating optimal gas prices and analyzing gas usage from recent blocks on the Kadena blockchain.
import {
estimateGasPrice,
getBlocksGasInformation,
} from '@kadena/client-utils';
estimateGasPrice
Estimates a suitable gas price by analyzing recent block data. The estimated value is the median of the minimum gas prices from a set of 20 recent blocks, after filtering out any empty blocks.
estimateGasPrice(parameters: IGasPriceEstimateProperties): Promise<number>
host?
(string): Optional base URL of the Chainweb API (defaults to
Kadena's mainnet/testnet based on networkId
).chainId
(string): Chain ID (e.g., "0"
through "19"
).networkId?
(string): Network ID (e.g., "mainnet01"
, "testnet04"
-
default "mainnet01"
).height?
(number): Optional block max height ( default the chian height).items?
(number): Number of blocks to fetch (default: 20
).Promise<number>
: Estimated gas price (defaults to 1e-7
if no transactions
are found).const price = await estimateGasPrice({
chainId: '0',
networkId: 'mainnet01',
});
console.log(`Suggested gas price: ${price}`);
getBlocksGasInformation
Fetches recent block data and returns gas usage statistics for each block. This information can be used to estimate gas prices based on custom criteria.
getBlocksGasInformation(parameters: IGasPriceEstimateProperties): Promise<IBlockGasInformation[]>
host?
(string): Optional base URL of the Chainweb API (defaults to
Kadena's mainnet/testnet based on networkId
).chainId
(string): Chain ID (e.g., "0"
through "19"
).networkId?
(string): Network ID (e.g., "mainnet01"
, "testnet04"
-
default "mainnet01"
).height?
(number): Optional block max height ( default the chian height).items?
(number): Number of blocks to fetch (default: 20
).Promise<IBlockGasInformation[]>
: Array of gas information objects per block.const blocks = await getBlocksGasInformation({
chainId: '0',
networkId: 'mainnet01',
});
console.log(blocks);
IBlockGasInformation
StructureEach block's gas info includes:
blockHeight
: Block numbertotalGasConsumed
: Sum of actual gas used by all txstotalGasLimit
: Sum of declared gas limitstotalGasPaid
: Total gasPrice * gasLimit
of all txstxCount
: Number of transactionsblockGasUsedPercent
: Gas usage vs block capacitygasPriceStats
:
min
: Minimum gas pricemax
: Maximum gas priceavg
: Average gas pricemedian
: Median gas pricehttps://api.chainweb.com
for mainnet and
https://api.testnet.chainweb.com
for testnet by default.150000
.FAQs
Utility functions build as a wrapper around @kadena/client
We found that @kadena/client-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.