@qubic-lib/qubic-ts-library v0.1.4
Qubic Typescript Library
A TS Library to communicate with the Qubic Network.
Overview
The Qubic Typescript Library is designed to facilitate communication with the Qubic Network. It provides various utilities and classes to interact with the network, manage cryptographic operations, and handle data structures specific to Qubic.
Installation
Install via NPM.
yarn add @qubic-lib/qubic-ts-library
Usage
Importing the Library
To use the library, you need to import the necessary classes and functions. Below is an example of how to import and use the QubicHelper
class.
// import helper
import { QubicHelper } from 'qubic-ts-library/dist/qubicHelper'
// create an id Package with private/public key and human readable address
const id = await helper.createIdPackage("alsdjflasjfdlasdjflkasdjflasdjlkdjsf");
Components
The library is composed of several key components, each serving a specific purpose:
- QubicConnector: Manages the connection to the Qubic Network.
- QubicDefinitions: Contains definitions and constants used throughout the library.
- QubicHelper: Provides helper functions for cryptographic operations and ID management.
- QubicPackageBuilder: Assists in building packages for communication with the network.
- DynamicPayload: Represents dynamic payloads used in transactions.
- Long: Handles long integer operations.
- PublicKey: Manages public key operations.
- QubicEntity: Represents entities within the Qubic Network.
- QubicTickData: Handles tick data structures.
- QubicTickInfo: Manages tick information.
- QubicTransaction: Represents transactions on the network.
- Signature: Manages digital signatures.
- QubicTransferAssetPayload: Handles asset transfer payloads.
- QubicTransferSendManyPayload: Manages payloads for sending multiple transfers.
Building the Library
To build the library into a single JavaScript file, use the following commands:
yarn install
yarn webpack
Node Sample Applications
requestBalance.js
Test how to receive Balance from Network
- Add the IDs to
const ids = ["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"];
in the filetest/requestBalance.js
. - Run the following commands:
yarn install
tsc
node test/requestBalance.js
sample-exchange.js
A lightweight sample of an exchange integration with Qubic. It can manage multiple users and handle deposits/withdrawals to one hot wallet.
This implementation is meant for demo purposes only!
To run the sample exchange:
yarn install
tsc
node test/sample-exchange.js
The Exchange initializes itsself. Start it and it will create a file exchange.json
. There you can find the Seeds used. If you do tests, save them anywhere.
Testing
Run tests with
yarn run test
Publish
publish with.
yarn build
yarn publish --access public
LICENSE
All Qubic Software is licensed unter the Anti Military License: https://github.com/qubic-network/license