## Core CI
### High level scenarious
Scenarios are writen in Typescript and runned via Runner CLI. Inside scenarios used high level entities that represent cli tools or network related entities. Example: tagionwalletCLI, wallet, network, etc..
> Highlevel entities means wrapped functionality and data with simple readable interface
>
Tools representation and functions:
- Wallet CLI = walletCLI
- generate wallet
- generate invoice
- generate contract
- send contract
- unlock balance
- get balance
- update balance
- Dartutil CLI = dartutilCLI
- create new dart
- dump dart
- read from dart by fp
- modify dart via recorder
- HiBONutil CLI = hibonutilCLI
- convert json to hibon
- convert hibon to json
- Tagionwave CLI = tagionwaveCLI
- set config
- run network mode0
- run network mode1~2
- Bootutil CLI = bootutilCLI
- convert invoice
Tools should be easy to use from code like:
```
var wallet = await walletCLI.createWallet(...);
```
Tools output structure `{ data: any, success: bool, message: string }`
If tool is working with files - it should generate new filename/file with random. Example - generate invoice require invoice path - that should be randomly generated `/tmp/rnd101412.hibon`
More important are entity that represent network ecosystem - we mostly working with them and they are using tools functionality:
- Wallet
- Data:
- path to wallet directory
- name?
- Functions:
- Generate
- Create invoice
- Pay invoice
- Create contract
- Send contract
- Get balance
- Update balance
- Unlock balance
- Dart
- path to file
- Network
- Data
- state: init, running, failed
- path to tagionwave.json ?
- Functions:
- Run mode0
- Run mode1
- Set param (in cmd)
- Set config (file)
- Modify config (any)
- Stop network
- Subscribe to log (with filter and callback)
- Invoice
- path to file
- Contract
- path to file
- Genesis (static)
- generate dart (receive wallets => produce dart with wallet's bills)
### Class diagram
```mermaid
classDiagram
EntityFile <|-- HiBON
HiBON <|-- Invoice
HiBON <|-- Contract
EntityFile <|-- Wallet
EntityFile <|-- Dart
CLI <|-- Network
CLI <|-- WalletCli
CLI <|-- HiBONCli
class EntityFile{
+String path
+ void setPath(string pth)
// convert relative to absolute path
}
class HiBON {
+ Buffer data
+ Base64 base64()
+ any object()
}
class CLI {
+ void ExecuteCmd()
}
class Wallet{
+ Invoice GenerateInvoice(string label, ulong amount)
+ Contract GenerateContract(Invoice invoice)
+ bool SendContract(Contract contract)
}
class Network{
+ Dart dart
+ HiBON configFile
+ void modifyConfigFile(any config)
+ void startMod0()
+ void startMod1()
}
```
### Execution
Each scenarios should run independent - in separete container with no access to outer world.
Diagram with how we run container is in notion
### Report
At the end - each scenarios should produce a complete log of execution: each function call and console output should be in this log.
```
Start scenario
Generate wallet - Wallet1
Output: wallet generated
Genesis called with - Wallet1 Amount: 1000
Output: ...
```
Additional log file could be a result of execution - in json format. Normaly this file is small and simple - but could be extended if result will contains mesurment reports - stored in data variable.
```
{
passed: bool,
message: string,
error: string,
line: number (?),
data: any
}
```
{"metaMigratedAt":"2023-06-17T11:30:22.156Z","metaMigratedFrom":"Content","title":"Untitled","breaks":true,"contributors":"[{\"id\":\"dd76b507-34d7-4357-bb47-ec4899f0a19c\",\"add\":4025,\"del\":167}]"}