New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dfinity/cmc

Package Overview
Dependencies
Maintainers
12
Versions
836
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dfinity/cmc - npm Package Compare versions

Comparing version 4.1.1 to 5.0.0-next-2025-02-04

dist/esm/chunk-T24JXLHY.js

2

dist/cjs/index.cjs.js

@@ -1,2 +0,2 @@

"use strict";var U=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var X=Object.prototype.hasOwnProperty;var J=(t,r)=>{for(var n in r)U(t,n,{get:r[n],enumerable:!0})},Q=(t,r,n,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of $(r))!X.call(t,i)&&i!==n&&U(t,i,{get:()=>r[i],enumerable:!(e=q(r,i))||e.enumerable});return t};var B=t=>Q(U({},"__esModule",{value:!0}),t);var j={};J(j,{CMCCanister:()=>f,CMCError:()=>_,InvalidaTransactionError:()=>l,ProcessingError:()=>d,RefundedError:()=>p,TransactionTooOldError:()=>u,throwNotifyError:()=>y});module.exports=B(j);var O=require("@dfinity/utils");var M=({IDL:t})=>{let r=t.Variant({Set:t.Principal,Unset:t.Null}),n=t.Text,e=t.Record({exchange_rate_canister:t.Opt(r),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(n),ledger_canister_id:t.Opt(t.Principal)}),i=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:i,Subnet:t.Record({subnet:t.Principal})}),C=t.Variant({controllers:t.Null,public:t.Null}),a=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(C),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),m=t.Record({subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),N=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),g=t.Variant({Ok:t.Principal,Err:N}),b=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),x=t.Record({certificate:t.Vec(t.Nat8),data:b,hash_tree:t.Vec(t.Nat8)}),R=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),T=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),c=t.Nat64,P=t.Record({controller:t.Principal,block_index:c,subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),s=t.Variant({Refunded:t.Record({block_index:t.Opt(c),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:c}),h=t.Variant({Ok:t.Principal,Err:s}),S=t.Opt(t.Vec(t.Nat8)),V=t.Opt(t.Vec(t.Nat8)),v=t.Record({block_index:c,deposit_memo:S,to_subaccount:V}),E=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),w=t.Variant({Ok:E,Err:s}),F=t.Record({block_index:c,canister_id:t.Principal}),k=t.Nat,A=t.Variant({Ok:k,Err:s});return t.Service({create_canister:t.Func([m],[g],[]),get_build_metadata:t.Func([],[t.Text],[]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],[]),get_icp_xdr_conversion_rate:t.Func([],[x],[]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[R],[]),get_subnet_types_to_subnets:t.Func([],[T],[]),notify_create_canister:t.Func([P],[h],[]),notify_mint_cycles:t.Func([v],[w],[]),notify_top_up:t.Func([F],[A],[])})};var z=({IDL:t})=>{let r=t.Variant({Set:t.Principal,Unset:t.Null}),n=t.Text,e=t.Record({exchange_rate_canister:t.Opt(r),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(n),ledger_canister_id:t.Opt(t.Principal)}),i=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:i,Subnet:t.Record({subnet:t.Principal})}),C=t.Variant({controllers:t.Null,public:t.Null}),a=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(C),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),m=t.Record({subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),N=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),g=t.Variant({Ok:t.Principal,Err:N}),b=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),x=t.Record({certificate:t.Vec(t.Nat8),data:b,hash_tree:t.Vec(t.Nat8)}),R=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),T=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),c=t.Nat64,P=t.Record({controller:t.Principal,block_index:c,subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),s=t.Variant({Refunded:t.Record({block_index:t.Opt(c),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:c}),h=t.Variant({Ok:t.Principal,Err:s}),S=t.Opt(t.Vec(t.Nat8)),V=t.Opt(t.Vec(t.Nat8)),v=t.Record({block_index:c,deposit_memo:S,to_subaccount:V}),E=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),w=t.Variant({Ok:E,Err:s}),F=t.Record({block_index:c,canister_id:t.Principal}),k=t.Nat,A=t.Variant({Ok:k,Err:s});return t.Service({create_canister:t.Func([m],[g],[]),get_build_metadata:t.Func([],[t.Text],["query"]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],["query"]),get_icp_xdr_conversion_rate:t.Func([],[x],["query"]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[R],["query"]),get_subnet_types_to_subnets:t.Func([],[T],["query"]),notify_create_canister:t.Func([P],[h],[]),notify_mint_cycles:t.Func([v],[w],[]),notify_top_up:t.Func([F],[A],[])})};var p=class extends Error{},l=class extends Error{},_=class extends Error{},d=class extends Error{},u=class extends Error{},y=({Err:t})=>{throw"Refunded"in t?new p(t.Refunded.reason):"InvalidTransaction"in t?new l(t.InvalidTransaction):"Processing"in t?new d:"TransactionTooOld"in t?new u:"Other"in t?new _(`Error in CMC with code ${t.Other.error_code}: ${t.Other.error_message}`):new Error(`Unsupported error type ${JSON.stringify(t)}`)};var f=class t extends O.Canister{constructor(){super(...arguments);this.getIcpToCyclesConversionRate=async()=>{let{data:n}=await this.service.get_icp_xdr_conversion_rate();return n.xdr_permyriad_per_icp};this.notifyCreateCanister=async n=>{let e=await this.service.notify_create_canister(n);if("Err"in e&&y(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyCreateCanister ${JSON.stringify(e)}`)};this.notifyTopUp=async n=>{let e=await this.service.notify_top_up(n);if("Err"in e&&y(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyTopUp ${JSON.stringify(e)}`)};this.getDefaultSubnets=async({certified:n}={})=>{let{get_default_subnets:e}=this.caller({certified:n});return e()};this.getSubnetTypesToSubnets=async({certified:n}={})=>{let{get_subnet_types_to_subnets:e}=this.caller({certified:n});return e()}}static create(n){let{service:e,certifiedService:i,canisterId:o}=(0,O.createServices)({options:n,idlFactory:z,certifiedIdlFactory:M});return new t(o,e,i)}};0&&(module.exports={CMCCanister,CMCError,InvalidaTransactionError,ProcessingError,RefundedError,TransactionTooOldError,throwNotifyError});
"use strict";var U=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var X=(t,r)=>{for(var n in r)U(t,n,{get:r[n],enumerable:!0})},J=(t,r,n,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of $(r))!Q.call(t,i)&&i!==n&&U(t,i,{get:()=>r[i],enumerable:!(e=q(r,i))||e.enumerable});return t};var B=t=>J(U({},"__esModule",{value:!0}),t);var j={};X(j,{CMCCanister:()=>f,CMCError:()=>_,InvalidaTransactionError:()=>l,ProcessingError:()=>d,RefundedError:()=>p,TransactionTooOldError:()=>u,throwNotifyError:()=>y});module.exports=B(j);var O=require("@dfinity/utils");var M=({IDL:t})=>{let r=t.Variant({Set:t.Principal,Unset:t.Null}),n=t.Text,e=t.Record({exchange_rate_canister:t.Opt(r),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(n),ledger_canister_id:t.Opt(t.Principal)}),i=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:i,Subnet:t.Record({subnet:t.Principal})}),C=t.Variant({controllers:t.Null,public:t.Null}),a=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(C),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),m=t.Record({subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),N=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),g=t.Variant({Ok:t.Principal,Err:N}),b=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),x=t.Record({certificate:t.Vec(t.Nat8),data:b,hash_tree:t.Vec(t.Nat8)}),R=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),T=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),c=t.Nat64,P=t.Record({controller:t.Principal,block_index:c,subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),s=t.Variant({Refunded:t.Record({block_index:t.Opt(c),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:c}),h=t.Variant({Ok:t.Principal,Err:s}),S=t.Opt(t.Vec(t.Nat8)),V=t.Opt(t.Vec(t.Nat8)),v=t.Record({block_index:c,deposit_memo:S,to_subaccount:V}),E=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),w=t.Variant({Ok:E,Err:s}),F=t.Record({block_index:c,canister_id:t.Principal}),k=t.Nat,A=t.Variant({Ok:k,Err:s});return t.Service({create_canister:t.Func([m],[g],[]),get_build_metadata:t.Func([],[t.Text],[]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],[]),get_icp_xdr_conversion_rate:t.Func([],[x],[]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[R],[]),get_subnet_types_to_subnets:t.Func([],[T],[]),notify_create_canister:t.Func([P],[h],[]),notify_mint_cycles:t.Func([v],[w],[]),notify_top_up:t.Func([F],[A],[])})};var z=({IDL:t})=>{let r=t.Variant({Set:t.Principal,Unset:t.Null}),n=t.Text,e=t.Record({exchange_rate_canister:t.Opt(r),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(n),ledger_canister_id:t.Opt(t.Principal)}),i=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:i,Subnet:t.Record({subnet:t.Principal})}),C=t.Variant({controllers:t.Null,public:t.Null}),a=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(C),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),m=t.Record({subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),N=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),g=t.Variant({Ok:t.Principal,Err:N}),b=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),x=t.Record({certificate:t.Vec(t.Nat8),data:b,hash_tree:t.Vec(t.Nat8)}),R=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),T=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),c=t.Nat64,P=t.Record({controller:t.Principal,block_index:c,subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),s=t.Variant({Refunded:t.Record({block_index:t.Opt(c),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:c}),h=t.Variant({Ok:t.Principal,Err:s}),S=t.Opt(t.Vec(t.Nat8)),V=t.Opt(t.Vec(t.Nat8)),v=t.Record({block_index:c,deposit_memo:S,to_subaccount:V}),E=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),w=t.Variant({Ok:E,Err:s}),F=t.Record({block_index:c,canister_id:t.Principal}),k=t.Nat,A=t.Variant({Ok:k,Err:s});return t.Service({create_canister:t.Func([m],[g],[]),get_build_metadata:t.Func([],[t.Text],["query"]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],["query"]),get_icp_xdr_conversion_rate:t.Func([],[x],["query"]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[R],["query"]),get_subnet_types_to_subnets:t.Func([],[T],["query"]),notify_create_canister:t.Func([P],[h],[]),notify_mint_cycles:t.Func([v],[w],[]),notify_top_up:t.Func([F],[A],[])})};var p=class extends Error{},l=class extends Error{},_=class extends Error{},d=class extends Error{},u=class extends Error{},y=({Err:t})=>{throw"Refunded"in t?new p(t.Refunded.reason):"InvalidTransaction"in t?new l(t.InvalidTransaction):"Processing"in t?new d:"TransactionTooOld"in t?new u:"Other"in t?new _(`Error in CMC with code ${t.Other.error_code}: ${t.Other.error_message}`):new Error(`Unsupported error type ${JSON.stringify(t)}`)};var f=class t extends O.Canister{constructor(){super(...arguments);this.getIcpToCyclesConversionRate=async({certified:n}={})=>{let{data:e}=await this.caller({certified:n}).get_icp_xdr_conversion_rate();return e.xdr_permyriad_per_icp};this.notifyCreateCanister=async n=>{let e=await this.service.notify_create_canister(n);if("Err"in e&&y(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyCreateCanister ${JSON.stringify(e)}`)};this.notifyTopUp=async n=>{let e=await this.service.notify_top_up(n);if("Err"in e&&y(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyTopUp ${JSON.stringify(e)}`)};this.getDefaultSubnets=async({certified:n}={})=>{let{get_default_subnets:e}=this.caller({certified:n});return e()};this.getSubnetTypesToSubnets=async({certified:n}={})=>{let{get_subnet_types_to_subnets:e}=this.caller({certified:n});return e()}}static create(n){let{service:e,certifiedService:i,canisterId:o}=(0,O.createServices)({options:n,idlFactory:z,certifiedIdlFactory:M});return new t(o,e,i)}};0&&(module.exports={CMCCanister,CMCError,InvalidaTransactionError,ProcessingError,RefundedError,TransactionTooOldError,throwNotifyError});
//# sourceMappingURL=index.cjs.js.map

@@ -1,2 +0,2 @@

import{a}from"./chunk-4XJEWVN3.js";import"./chunk-XRC5EOJ2.js";export{a as CMCCanister};
import{a}from"./chunk-T24JXLHY.js";import"./chunk-XRC5EOJ2.js";export{a as CMCCanister};
//# sourceMappingURL=cmc.canister.js.map

@@ -1,2 +0,2 @@

import{a as e}from"./chunk-4XJEWVN3.js";import{a as o,b as r,c as t,d as p,e as s,f as n}from"./chunk-XRC5EOJ2.js";export{e as CMCCanister,t as CMCError,r as InvalidaTransactionError,p as ProcessingError,o as RefundedError,s as TransactionTooOldError,n as throwNotifyError};
import{a as e}from"./chunk-T24JXLHY.js";import{a as o,b as r,c as t,d as p,e as s,f as n}from"./chunk-XRC5EOJ2.js";export{e as CMCCanister,t as CMCError,r as InvalidaTransactionError,p as ProcessingError,o as RefundedError,s as TransactionTooOldError,n as throwNotifyError};
//# sourceMappingURL=index.js.map

@@ -8,7 +8,10 @@ import type { Principal } from "@dfinity/principal";

/**
* Returns conversion rate of ICP to Cycles
* Returns conversion rate of ICP to Cycles. It can be called as query or update.
*
* @param {Object} [params] - The parameters for the call.
* @param {boolean} [params.certified] - Determines whether the response should be certified (default: non-certified)
*
* @returns Promise<BigInt>
*/
getIcpToCyclesConversionRate: () => Promise<bigint>;
getIcpToCyclesConversionRate: ({ certified, }?: QueryParams) => Promise<bigint>;
/**

@@ -15,0 +18,0 @@ * Notifies Cycles Minting Canister of the creation of a new canister.

{
"name": "@dfinity/cmc",
"version": "4.1.1",
"version": "5.0.0-next-2025-02-04",
"description": "A library for interfacing with the cycle minting canister.",

@@ -39,7 +39,7 @@ "license": "Apache-2.0",

"peerDependencies": {
"@dfinity/agent": "^2.0.0",
"@dfinity/candid": "^2.0.0",
"@dfinity/principal": "^2.0.0",
"@dfinity/utils": "^2.9.0"
"@dfinity/agent": "*",
"@dfinity/candid": "*",
"@dfinity/principal": "*",
"@dfinity/utils": "*"
}
}
}

@@ -79,10 +79,15 @@ # cmc-js

Returns conversion rate of ICP to Cycles
Returns conversion rate of ICP to Cycles. It can be called as query or update.
| Method | Type |
| ------------------------------ | ----------------------- |
| `getIcpToCyclesConversionRate` | `() => Promise<bigint>` |
| Method | Type |
| ------------------------------ | --------------------------------------------------- |
| `getIcpToCyclesConversionRate` | `({ certified, }?: QueryParams) => Promise<bigint>` |
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L32)
Parameters:
- `params`: - The parameters for the call.
- `params.certified`: - Determines whether the response should be certified (default: non-certified)
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L35)
##### :gear: notifyCreateCanister

@@ -97,3 +102,3 @@

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L49)
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L57)

@@ -109,3 +114,3 @@ ##### :gear: notifyTopUp

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L77)
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L85)

@@ -127,3 +132,3 @@ ##### :gear: getDefaultSubnets

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L102)
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L110)

@@ -146,4 +151,4 @@ ##### :gear: getSubnetTypesToSubnets

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L121)
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L129)
<!-- TSDOC_END -->

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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