Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@dfinity/cmc
Advanced tools
A library for interfacing with the cycle minting canister.
You can use cmc-js
by installing it in your project.
npm i @dfinity/cmc
The bundle needs peer dependencies, be sure that following resources are available in your project as well.
npm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils
The features are available through the class CMCCanister
. It has to be instantiated with the canister ID of the cycles minting canister. On mainnet
, its ID is rkp4c-7iaaa-aaaaa-aaaca-cai
.
e.g. querying the current Icp to cycles conversion rate.
import { CMCCanister } from "@dfinity/cmc";
import { createAgent } from "@dfinity/utils";
const agent = await createAgent({
identity,
host: HOST,
});
const { getIcpToCyclesConversionRate } = CMCCanister.create({
agent,
canisterId: CYCLES_MINTING_CANISTER_ID,
});
const rate = await getIcpToCyclesConversionRate();
cmc-js
implements following features:
Method | Type |
---|---|
create | (options: CMCCanisterOptions) => CMCCanister |
Returns conversion rate of ICP to Cycles
Method | Type |
---|---|
getIcpToCyclesConversionRate | () => Promise<bigint> |
Notifies Cycles Minting Canister of the creation of a new canister. It returns the new canister principal.
Method | Type |
---|---|
notifyCreateCanister | (request: NotifyCreateCanisterArg) => Promise<Principal> |
Notifies Cycles Minting Canister of new cycles being added to canister. It returns the new Cycles of the canister.
Method | Type |
---|---|
notifyTopUp | (request: NotifyTopUpArg) => Promise<bigint> |
This function calls the get_default_subnets
method of the CMC canister, which returns a list of
default subnets as Principal
objects. It can be called as query or update.
Method | Type |
---|---|
getDefaultSubnets | ({ certified }?: QueryParams) => Promise<Principal[]> |
Parameters:
params
: - The query parameters for the call.params.certified
: - Determines whether the response should be certified
(default: non-certified if not specified).FAQs
A library for interfacing with the cycle minting canister.
The npm package @dfinity/cmc receives a total of 1,443 weekly downloads. As such, @dfinity/cmc popularity was classified as popular.
We found that @dfinity/cmc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.