FCTs
Active Module
This module defines functions for handling active services in an FCT application. It provides an API for interacting with active fcts, such as publishing, removing, and adding signatures to them. This document contains code examples to help you understand how to use the functions defined in the module.
Importing Dependencies
First, you need to import the required dependencies from the appropriate packages:
Publish a New FCT
To publish a new active service, use the publish.execute
function. It takes an object with data, serial, autoSign, and autoClear properties.
Remove an Active Service
To remove an active service, use the remove.execute
function. It takes an object with the id of the active service you want to remove.
Add Signature to an Active Service
To add a signature to an active service, use the addSignature.execute
function. It takes an object with the id of the active service and the signature you want to add.
Update Active Services List
To update the list of active services, use the updateActiveList
function. It will fetch the updated list of active services and rebuild the raw and formatted active lists.
By following these examples, you can interact with active services using the functions provided in the module.
History
Fuel Module
The fuel module is responsible for interacting with the Kirobo Service to manage funds and fuel usage for the Kirobo network.
Imports
Constants and Variables
SERVICE
: A constant for the fuel service name.ENDPOINT
: A constant for the fuel endpoint._callId
: A variable to track the call ID.INIT_FUEL
: An initial fuel object with default values.watchedNetworkName
: A variable to store the currently watched network name.
Functions
formatFuelValue
Formats the fuel value for the given name.
Parameters:
value: string
: The value to be formatted.name: string
: The name of the fuel (e.g., 'kiro', 'eth').
Returns: The formatted fuel value.
formatFuel
Formats a fuel object, calling formatFuelValue
for each value in the object.
Parameters:
res: IFunds
: The fuel object to be formatted.
Returns: The formatted fuel object.
fuel
An object containing two signals, raw
and formatted
, representing the raw and formatted fuel data, respectively.
networkName
A computed value representing the current network name.
unwatchFuel
An async function that removes all event listeners for the current network endpoint and resets the fuel data.
updateFuel
Updates the fuel object with the new data.
Parameters:
res: IFunds
: The new fuel data.
watchFuel
An async function that watches for changes in the network name, and updates the fuel data accordingly. It also listens for updates to the fuel data from the Kirobo Service.
Usage Example
To watch for fuel updates and get the formatted fuel data, you can use the following example:
To stop watching for fuel updates, you can use the unwatchFuel
function:
Last updated