blockchain #
stellar
To get started
import freeflowuniverse.crystallib.blockchain.stellar
mut client:= stellar.get()!
client...
example heroscript
!!stellar.configure
secret: '...'
host: 'localhost'
port: 8888
fn new #
fn new(args NewArgs) !DADB
fn play #
fn play(args_ PlayArgs) !
fn play_asset #
fn play_asset(p paramsparser.Params) !
enum BlockChainType #
enum BlockChainType {
stellar
stellar_test
}
struct Account #
@[heap]
struct Account {
pub mut:
id u32
name string
secret string
pubkey string
description string
cat string
owner string
assets []Asset
bctype BlockChainType
}
fn (Account) encode #
fn (mut self Account) encode() ![]u8
fn (Account) decode #
fn (mut self Account) decode(data []u8) !Account
struct AccountGetArgs #
@[params]
struct AccountGetArgs {
pub mut:
owner string @[required]
name string @[required]
bctype BlockChainType
}
////// ACCOUNT GETTERS
struct AssetPosition #
@[heap]
struct AssetPosition {
pub mut:
amount f64
assettype u32
}
fn (AssetPosition) name #
fn (self AssetPosition) name(db dbfs.DB) AssetPosition
struct AssetType #
struct AssetType {
pub mut:
id u32
name string
issuer string
bctype BlockChainType
}
struct AssetTypeArgs #
@[params]
struct AssetTypeArgs {
pub mut:
name string @[required]
issuer string @[required]
bctype BlockChainType
}
now store in the DB
struct DADB #
@[heap]
struct DADB {
pub mut:
name string
secret string
db ourdb.OurDB
meilisearch meilisearch.MeilisearchClient
}
fn (DADB) account_get #
fn (mut self DADB) account_get(args_ AccountGetArgs) !&Account
fn (DADB) accounts_get #
fn (mut self DADB) accounts_get(args_ AccountGetArgs) ![]&Account
fn (DADB) assettype_get #
fn (mut db DADB) assettype_get(id u32) !AssetType
fn (DADB) assettype_set #
fn (mut db DADB) assettype_set(args AssetTypeArgs) !AssetType
fn (DADB) owner_get #
fn (mut self DADB) owner_get(name_ string) !&Owner
owner_get_set returns owner by name, if not exist creates new one
fn (DADB) owner_get_set #
fn (mut self DADB) owner_get_set(name_ string) !&Owner
owner_get_set returns owner by name, if not exist creates new one
struct NewArgs #
@[params]
struct NewArgs {
pub mut:
path string @[required] // path where all the DB info will be
secret string @[required]
}
struct Owner #
@[heap]
struct Owner {
pub mut:
name string
accounts []Account
}
struct PlayArgs #
@[params]
struct PlayArgs {
pub mut:
name string = 'default'
heroscript string // if filled in then plbook will be made out of it
path string
plbook ?playbook.PlayBook
// reset bool
}