Quick Start
Kirobo FCT-SDK Documentation
Welcome to the Kirobo FCT-SDK documentation! This SDK is designed to simplify interactions with Kirobo services and blockchain resources.
Table of Contents
Introduction
The Kirobo FCT-SDK is a powerful tool for developers to interact with Kirobo.io services and blockchain resources. The SDK provides an easy-to-use interface for managing FCTs, wallets, tokens, NFTs, and more.
Installation
To install the SDK, run the following command in your project directory:
Getting Started
First, import the SDK and create a new ethers.Wallet
instance with the private key and provider:
Then, configure the SDK by providing the key
, secret
, and signer
:
API Reference
Service
service.start(config)
: Start the service with the given configuration.service.config(options)
: Configure the service with the given options.service.session
: Contains session information, such as wallet and vault.service.network
: Contains network information, such as height, gas price, and KIRO price.
Tokens
service.tokens.wallet
: Provides access to wallet token data.service.tokens.vault
: Provides access to vault token data.
NFTs
service.nfts.wallet
: Provides access to wallet NFT data.service.nfts.vault
: Provides access to vault NFT data.
FCT
service.fct.fuel
: Contains fuel information, both raw and formatted.service.fct.active
: Contains the active list of FCT resources.
Examples
Below are some examples to help you get started with the SDK:
Log network information:
Log wallet and vault addresses:
Log wallet and vault token balances:
Log wallet and vault NFTs:
Log fuel information:
Log the active list of FCT resources:
Log values using signals and computed properties:
Log session status:
These examples demonstrate various ways to interact with the KiroboIO KI-FCT-SDK. You can use them as a starting point for building your own applications and services with the SDK.
API Reference
Service
service.start(config)
: Start the service with the given configuration. The configuration object should include thekey
andsecret
for the KiroboIO API.config
: Object with the following properties:key
: String, the KiroboIO API key.secret
: String, the KiroboIO API secret.
service.config(options)
: Configure the service with the given options. The options object should include thesigner
and optionally anautoLogin
boolean.options
: Object with the following properties:signer
: ethers.Wallet instance, the signer for the wallet.autoLogin
: Boolean (optional), set totrue
to automatically log in upon configuration. Default isfalse
.
service.session
: Contains session information, such as wallet and vault.wallet
: Wallet address associated with the signer.vault
: Vault address associated with the signer.status
: Session status, representing the connection state.
service.network
: Contains network information, such as height, gas price, and KIRO price.height
: Number, the current block height of the network.gasPrice
: Number, the current gas price in the network.kiroPrice
: Number, the current price of KIRO token in the network.
Tokens
service.tokens.wallet
: Provides access to wallet token data.raw.list
: Array, a list of raw token data in the wallet.formatted.list
: Array, a list of formatted token data in the wallet.
service.tokens.vault
: Provides access to vault token data.raw.list
: Array, a list of raw token data in the vault.formatted.list
: Array, a list of formatted token data in the vault.
NFTs
service.nfts.wallet
: Provides access to wallet NFT data.raw.list
: Array, a list of raw NFT data in the wallet.
service.nfts.vault
: Provides access to vault NFT data.raw.list
: Array, a list of raw NFT data in the vault.
FCT
service.fct.fuel
: Contains fuel information, both raw and formatted.raw
: Object, raw fuel data.formatted
: Object, formatted fuel data.
service.fct.active
: Contains the active list of FCT resources.raw.list
: Array, a list of raw active FCT resources.
Utility Functions
computed(fn)
: Creates a computed property based on the provided function. The function should return a value based on the SDK's reactive properties.fn
: Function, a function that returns a value based on the SDK's reactive properties.
effect(fn)
: Executes the provided function when the reactive properties used within it change.fn
: Function, a function that uses the SDK's reactive properties.
signal(initialValue)
: Creates a reactive signal with the provided initial value. The signal can be used in computed properties and effects.initialValue
: Any, the initial value of the signal.
Examples
To help you better understand how to use the SDK, here are some additional examples:
Update a signal value:
Update a signal value with a nested object:
Listen to changes in a specific token balance:
Transfer tokens from wallet to vault:
Transfer NFTs from wallet to vault:
These examples demonstrate various ways to interact with the KiroboIO KI-FCT-SDK. You can use them as a starting point for building your own applications and services with the SDK.
Last updated