Socket
Socket
Sign inDemoInstall

@cere-ddc-sdk/blockchain

Package Overview
Dependencies
10
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @cere-ddc-sdk/blockchain

Cere Blockchain client


Version published
Weekly downloads
179
decreased by-33.95%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

2.7.0-rc.2 (2024-04-17)

Features

  • cli: Add CLI option to override default blockchain RPC URL (#244) (1a8f9fd)

Readme

Source

@cere-ddc-sdk/blockchain

The package provides API for interacting with Cere blockchain.

Installation

Using NPM:

npm install @cere-ddc-sdk/blockchain --save

Using yarn:

yarn add @cere-ddc-sdk/blockchain

Usage

The package provides Blockchain class which acts as an entry point and multiple DDC pallet wrappers, each of which is responsible for interacting with a particular DDC pallet on the blockchain.

Here is an example how to create a bucket

  1. Create a Blockchain instance and connect it to TESTNET

    import { Blockchain, UriSigner } from '@cere-ddc-sdk/blockchain';
    
    const account = new UriSigner('//Alice');
    const blockchain = await Blockchain.connect({
      wsEndpoint: 'wss://rpc.testnet.cere.network/ws',
    });
    
  2. Make a deposit

    const deposit = 100n * 10n ** blockchain.chainDecimals; // 100 CERE
    const tx = blockchain.ddcCustomers.deposit(deposit);
    
    await blockchain.send(tx, { account })
    

    The account used to make deposit and create the bucket should have positive CERE tokens balance.

  3. Create a public bucket

    const clusterId = '0x...';
    const tx = blockchain.ddcCustomers.createBucket(clusterId, { isPublic: true });
    
    const { events } = await blockchain.send(tx, { account })
    const [bucketId] = blockchain.ddcCustomers.extractCreatedBucketIds(events);
    
    console.log('Bucket ID', bucketId);
    

Documentation

For more information about what this package provides, see API reference

License

Licensed under the Apache License

FAQs

Last updated on 17 Apr 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc