
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
@ccamp/lib
Advanced tools
The CCAMPClient
is a TypeScript class designed to streamline interactions with various CCAMP canisters, including the Remittance canister, the Data collection canister, and the Protocol data collection canister. This class enables users to engage with Data Collection, Protocol Data Collection, and Remittance canisters on the IC network using Ethereum-based private keys.
Ensure you have the necessary dependencies installed:
npm install
The CCAMPClient
is versatile, supporting both development and production environments. This flexibility is achieved by providing an optional options
parameter to the constructor. The env
property within this parameter allows users to specify the environment, determining which network the CCAMP canisters will be instantiated on. By default, the environment is set to prod
for production, but users can easily switch to local
for development. Example usage:
constructor(ethereumPrivateKey: string, options?: { env?: Environment })
ethereumPrivateKey
: Private key for the Ethereum account.options.env
: Environment (default is ENV.prod
). Options: prod
or local
.const ccampClient = new CCAMPClient('your_ethereum_private_key', { env: ENV.prod });
getCanisterInstance(canisterType: CanisterType, overrides?: { canisterId?: string }): any
canisterType
: Type of the IC canister (e.g., CANISTER_TYPES.DATA_COLLECTION
).overrides.canisterId
: Override the default canister ID.const dataCollectionCanister = ccampClient.getCanisterInstance(CANISTER_TYPES.DATA_COLLECTION);
Approve the locker contract to spend tokens on your behalf.
approveLockerContract(erc20TokenAddress: string, amountToApprove: ethers.BigNumberish, signer: ethers.Wallet, overrides?: { lockerContract?: string }): Promise<any>
erc20TokenAddress
: Ethereum address of the ERC20 token.amountToApprove
: Amount to approve for the locker contract.signer
: Ethereum Wallet signer.overrides.lockerContract
: Override the default locker contract address.await ccampClient.approveLockerContract('token_address', amount, signer);
Deposit funds into the protocol.
deposit(amount: ethers.BigNumberish, tokenAddress: string, signer: ethers.Wallet, overrides?: { lockerContract?: string; dcCanister?: string }): Promise<Transaction>
amount
: Amount to deposit.tokenAddress
: Ethereum address of the token.signer
: Ethereum Wallet signer.overrides.lockerContract
: Override the default locker contract address.overrides.dcCanister
: Override the default data collection canister ID.await ccampClient.deposit(amount, 'token_address', signer);
Withdraw funds from the network.
withdraw(amount: ethers.BigNumberish, tokenAddress: string, chain: string ,signer: ethers.Wallet, overrides?: { lockerContract?: string; dcCanister?: string; remittanceCanister?: string }): Promise<Transaction>
amount
: Amount to withdraw.tokenAddress
: Ethereum address of the token.chain
: Blockchain identifier.signer
: Ethereum Wallet signer.overrides.lockerContract
: Override the default locker contract address.overrides.dcCanister
: Override the default data collection canister ID.overrides.remittanceCanister
: Override the default remittance canister ID.await ccampClient.withdraw(amount, 'token_address', signer, 'ethereum');
Below are the types used in the CCAMPClient
class:
export type Environment = 'prod' | 'dev';
prod
: Production environment.dev
: Development environment.export type CanisterType = 'dataCollection' | 'protocolDataCollection' | 'remittance';
dataCollection
: Type for Data Collection canister.protocolDataCollection
: Type for Protocol Data Collection canister.remittance
: Type for Remittance canister.export type DataCollectionCanister;
export type ProtocolDataCollectionCanister;
export type RemittanceCanister;
DataCollectionCanister
: Type for Data Collection canister instance.ProtocolDataCollectionCanister
: Type for Protocol Data Collection canister instance.RemittanceCanister
: Type for Remittance canister instance.These types are integral to the proper functioning of the CCAMPClient.getCanisterInstance
method, providing a more specific interface for the different canister types.
This documentation provides a brief overview of the CCAMPClient
class and its methods. Refer to the inline comments in the code for more detailed explanations of each method and its parameters.
FAQs
The javascript library for interacting with the ccamp
The npm package @ccamp/lib receives a total of 0 weekly downloads. As such, @ccamp/lib popularity was classified as not popular.
We found that @ccamp/lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.