Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dfinity/cmc

Package Overview
Dependencies
Maintainers
10
Versions
818
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dfinity/cmc

A library for interfacing with the cycle minting canister.

  • 3.0.5-next-2024-06-04
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8K
decreased by-20.06%
Maintainers
10
Weekly downloads
 
Created
Source

cmc-js

A library for interfacing with the cycle minting canister.

npm version GitHub license

Table of contents

Installation

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

Usage

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();

Features

cmc-js implements following features:

:factory: CMCCanister

:link: Source

Methods
:gear: create
MethodType
create(options: CMCCanisterOptions) => CMCCanister

:link: Source

:gear: getIcpToCyclesConversionRate

Returns conversion rate of ICP to Cycles

MethodType
getIcpToCyclesConversionRate() => Promise<bigint>

:link: Source

:gear: notifyCreateCanister

Notifies Cycles Minting Canister of the creation of a new canister. It returns the new canister principal.

MethodType
notifyCreateCanister(request: NotifyCreateCanisterArg) => Promise<Principal>

:link: Source

:gear: notifyTopUp

Notifies Cycles Minting Canister of new cycles being added to canister. It returns the new Cycles of the canister.

MethodType
notifyTopUp(request: NotifyTopUpArg) => Promise<bigint>

:link: Source

Keywords

FAQs

Package last updated on 04 Jun 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc