Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@kiltprotocol/augment-api
Advanced tools
This package provides TypeScript interfaces for data structures and transaction types used on the KILT blockchain.
It improves the developer experience when using @polkadot/api
to interact with the KILT blockchain and is required for the use of @kiltprotocol/sdk-js
in a TypeScript development environment.
@polkadot/api
and (optionally) @kiltprotocol/sdk-js
.@polkadot/api
alone, also include @kiltprotocol/type-definitions
in your project.
These definitions must be passed to the API constructor. For detailed guidance, refer to its package documentation.To install, run:
yarn add --dev @kiltprotocol/augment-api
Add the following import at the beginning of your application's entry point:
// this import should be made at the earliest point possible
import '@kiltprotocol/augment-api'
// imports of other KILT or Polkadot packages should follow
import { connect } from '@kiltprotocol/sdk-js'
const api = await connect('wss://…')
// api is now augmented with types for the latest Spiritnet runtime
api.tx.did.dispatchAs()
We release types corresponding to each runtime version of our mainnet and testnet, aligned with the blockchain client releases.
To use types for a specific runtime version, simply pin their corresponding client release version:
yarn add --dev @kiltprotocol/augment-api@1.11300.0
For the Peregrine testnet, append -peregrine
:
yarn add --dev @kiltprotocol/augment-api@1.11300.0-peregrine
To always use the latest Peregrine testnet types, use the peregrine
distribution tag:
yarn add --dev @kiltprotocol/augment-api@peregrine
Each version of the package indicates, via peer dependencies on @polkadot/api
& @polkadot/typegen
, which versions of these packages were used to generate types.
Sometimes definitions of Polkadot built-in runtime components change between releases of these libraries, resulting in type conflicts when trying to use the generated types with a different release.
If you need to use divergent @polkadot/api
versions in your project, you can run the generator scripts to regenerate type definitions based on your local configuration.
@polkadot/typegen
to your package dependencies, matching your version of @polkadot/api
.typescript
and @kiltprotocol/type-definitions
installed.Regenerate types using:
yarn run kilt_reaugment
For persistency across installations, we recommend adding a postinstall script to your package.json
:
{
"scripts": {
"postinstall": "yarn run kilt_reaugment"
}
}
The kilt_reaugment
script can also generate types for other KILT runtimes, such as for our staging or standalone chains.
Run yarn kilt_reaugment --help
to learn more about its command line arguments.
This functionality is best used in combination with the kilt_updateMetadata
package script, which fetches runtime metadata and version information from a blockchain client:
yarn run kilt_updateMetadata -e wss://peregrine.kilt.io
This creates a file with the chain's metadata, along with a .env.kilt
file that changes the default behavior of kilt_reaugment
to perform type generation based on this metadata file.
Commit these files to your project and include kilt_reaugment
in your postinstall script (see above) to ensure types are always up-to-date with your project metadata.
FAQs
Unknown package
We found that @kiltprotocol/augment-api demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.