
Security News
npm βisβ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
@frequency-chain/api-augment
Advanced tools
RPC configuration for Frequency for use with Polkadotjs API
An easy way to get all the custom rpc and types config to be able to easily use Frequency with the Polkadot JS API library with TypeScript.
npm install @frequency-chain/api-augment
(API Augmentation Library)npm install @polkadot/api
(Polkadot API Library)For details on use, see the Polkadot API library documentation.
import { options } from "@frequency-chain/api-augment";
import { ApiPromise } from '@polkadot/api';
// ...
const api = await ApiPromise.create({
...options,
// ...
});
See CONTRIBUTING.md for more information.
Update ./definitions
if you have changed any types or RPC calls.
To generate the JS api definitions, run
make js
This command will start a Frequency node in the background and fetch API definitions from it. To stop the Frequency process, use the PID output by the command.
The api augmentation declares the modules used by @polkadot/api
.
Thus the import for @frequency-chain/api-augment
must come before any @polkadot/api
so that the Frequency declarations resolve first.
import { options } from "@frequency-chain/api-augment";
// Or
import "@frequency-chain/api-augment";
// Must come BEFORE any imports from @polkadot/api
import { ApiPromise } from '@polkadot/api';
Caches can also wreck this even if you reorder, so watch out.
yarn cache clear
node_modules
helps as well: rm -Rf node_modules
Optional responses are not mapped to null
and instead return an object with a few properties.
For more details see the code for the Option class.
const optionalExample = await api.rpc.schemas.getBySchemaId(1);
// Does the Option have a value?
if (!optionalExample.isEmpty) {
// Get the value
return optionalExample.value;
}
return null;
Vector responses are not mapped directly to a JavaScript Array.
Instead they are mapped to the Vec class which does extend Array.
Thus, you can still use map
, forEach
, etc... with responses or access the values directing via .values()
.
Distributed under the Apache 2.0 License. See LICENSE
for more information.
FAQs
RPC configuration for Frequency for use with Polkadotjs API
We found that @frequency-chain/api-augment demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 3 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
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.