5.2.3 • Published 8 months ago

@dfinity/ic-management v5.2.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months ago

ic-management-js

A library for interfacing with the Internet Computer (IC) management canister.

npm version GitHub license

Table of contents

Installation

You can use ic-management-js by installing it in your project.

npm i @dfinity/ic-management

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 ICMgmtCanister. It has to be instantiated with a canister ID.

e.g. fetching a token metadata.

import { ICManagementCanister } from "@dfinity/ic-management";
import { createAgent } from "@dfinity/utils";

const agent = await createAgent({
  identity,
  host: HOST,
});

const { canisterStatus } = ICManagementCanister.create({
  agent,
});

const { status, memory_size, ...rest } = await canisterStatus(YOUR_CANISTER_ID);

Features

ic-management-js implements following features:

:factory: ICManagementCanister

:link: Source

Methods

:gear: create
MethodType
create(options: ICManagementCanisterOptions) => ICManagementCanister

:link: Source

:gear: createCanister

Create a new canister

MethodType
createCanister({ settings, senderCanisterVersion, }?: CreateCanisterParams) => Promise<Principal>

:link: Source

:gear: updateSettings

Update canister settings

MethodType
updateSettings({ canisterId, senderCanisterVersion, settings, }: UpdateSettingsParams) => Promise<void>

:link: Source

:gear: installCode

Install code to a canister

MethodType
installCode({ mode, canisterId, wasmModule, arg, senderCanisterVersion, }: InstallCodeParams) => Promise<void>

:link: Source

:gear: uploadChunk

Upload chunks of Wasm modules that are too large to fit in a single message for installation purposes.

MethodType
uploadChunk({ canisterId, ...rest }: UploadChunkParams) => Promise<chunk_hash>

Parameters:

  • params.canisterId: The canister in which the chunks will be stored.
  • params.chunk: A chunk of Wasm module.

:link: Source

:gear: clearChunkStore

Clear the entire chunk storage of a canister.

MethodType
clearChunkStore({ canisterId, }: ClearChunkStoreParams) => Promise<void>

Parameters:

  • params.canisterId: The canister in which the chunks are stored.

:link: Source

:gear: storedChunks

List the hashes of chunks in the chunk storage of a canister.

MethodType
storedChunks({ canisterId, }: StoredChunksParams) => Promise<chunk_hash[]>

Parameters:

  • params.canisterId: The canister in which the chunks are stored.

:link: Source

:gear: installChunkedCode

Installs code that had previously been uploaded in chunks.

MethodType
installChunkedCode({ mode, arg, senderCanisterVersion, chunkHashesList, targetCanisterId, storeCanisterId, wasmModuleHash, }: InstallChunkedCodeParams) => Promise<void>

Parameters:

  • params.mode: Installation, re-installation or upgrade.
  • params.arg: The arguments of the canister.
  • params.senderCanisterVersion: The optional sender_canister_version parameter can contain the caller's canister version.
  • params.chunkHashesList: The list of chunks of the Wasm module to install.
  • params.targetCanisterId: Specifies the canister where the code should be installed.
  • params.storeCanisterId: Specifies the canister in whose chunk storage the chunks are stored (this parameter defaults to target_canister if not specified).
  • params.wasmModuleHash: The Wasm module hash as hex string. Used to check that the SHA-256 hash of wasm_module is equal to the wasm_module_hash parameter and can calls install_code with parameters.

:link: Source

:gear: uninstallCode

Uninstall code from a canister

MethodType
uninstallCode({ canisterId, senderCanisterVersion, }: UninstallCodeParams) => Promise<void>

:link: Source

:gear: startCanister

Start a canister

MethodType
startCanister(canisterId: Principal) => Promise<void>

:link: Source

:gear: stopCanister

Stop a canister

MethodType
stopCanister(canisterId: Principal) => Promise<void>

:link: Source

:gear: canisterStatus

Get canister details (memory size, status, etc.)

MethodType
canisterStatus(canisterId: Principal) => Promise<canister_status_result>

:link: Source

:gear: deleteCanister

Deletes a canister

MethodType
deleteCanister(canisterId: Principal) => Promise<void>

:link: Source

:gear: provisionalCreateCanisterWithCycles

Creates a canister. Only available on development instances.

MethodType
provisionalCreateCanisterWithCycles({ settings, amount, canisterId, }?: ProvisionalCreateCanisterWithCyclesParams) => Promise<Principal>

:link: Source

Resources

5.2.3

8 months ago

5.2.2

9 months ago

5.2.1

9 months ago

5.0.1

1 year ago

5.0.0

1 year ago

5.1.0

11 months ago

5.2.0

10 months ago

4.0.0

1 year ago

3.2.0

1 year ago

3.1.1

1 year ago

3.1.0

1 year ago

3.0.0

1 year ago

2.2.2

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.1.0

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago