Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend examples [WIP] #18

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
23 changes: 0 additions & 23 deletions Rust/README.md

This file was deleted.

5 changes: 5 additions & 0 deletions examples/iroha_client_cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Examples for `iroha_client_cli`

`cli` directory contains examples of using the binary through its CLI.

`json` directory contains examples of using the binary through its JSON API.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"id": "looking_glass",
"accounts": {},
"asset_definitions": {},
"asset_total_quantities": {},
"logo": null,
"metadata": {}
}
]
7 changes: 7 additions & 0 deletions examples/iroha_client_cli/cli/tutorial-3-register-domain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
iroha_client_cli domain register --id "looking_glass"
# returns "..." tx hash

# FIXME: would be good to have at least JSON5 here or some other CLI-friendly format
iroha_client_cli domain list filter '{ Identifiable: { Is: "looking_glass" } }'

# should return: ./tutorial-3-register-domain.output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"id": "white_rabbit@looking_glass",
"assets": {},
"signatories": [
"ed0120E7BF9FD343AF8C112AE4AF12FEE1D21EDD3403D97562758C9AA12074A793E95B"
],
"signature_check_condition": {
"AnyAccountSignatureOr": []
},
"metadata": {},
"roles": []
}
]
6 changes: 6 additions & 0 deletions examples/iroha_client_cli/cli/tutorial-4-register-account.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
iroha_client_cli account register \
--id 'white_rabbit@looking_glass' \
--key 'ed0120E7BF9FD343AF8C112AE4AF12FEE1D21EDD3403D97562758C9AA12074A793E95B'
# tx hash

iroha_client_cli account list filter '{ Identifiable: { Is: "white_rabbit@looking_glass" } }'
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"id": "time##white_rabbit@looking_glass",
"value": {
"Quantity": 35
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"id": "time##white_rabbit@looking_glass",
"value": {
"Quantity": 42
}
}
]
23 changes: 23 additions & 0 deletions examples/iroha_client_cli/cli/tutorial-5-asset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
iroha_client_cli asset register \
--id 'time#looking_glass' \
--value-type Quantity \
--unmintable # mintable once

# iroha_client_cli asset list filter '{ "Identifiable": { "Is": "time#looking_glass" } }'
# FIXME: lol `asset register` creates an asset DEFINITION, but `asset list` doesn't return a definition

iroha_client_cli asset mint \
--account 'white_rabbit@looking_glass' \
--asset 'time#looking_glass' \
--quantity 42
# FIXME: Fixed-type quantity is not supported
# --quantity=12.34

iroha_client_cli asset list filter '{ Identifiable: { StartsWith: "time" } }'

iroha_client_cli asset burn \
--account 'white_rabbit@looking_glass' \
--asset 'time#looking_glass' \
--quantity 7

iroha_client_cli asset list filter '{ Identifiable: { StartsWith: "time" } }'
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
Register: {
NewDomain: {
id: "looking_glass",
// FIXME: remove empty metadata requirement
metadata: {}
}
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
Register: {
NewAccount: {
id: "white_rabbit@looking_glass",
signatories: [
"ed0120E7BF9FD343AF8C112AE4AF12FEE1D21EDD3403D97562758C9AA12074A793E95B"
],
// FIXME: remove empty metadata requirement
metadata: {}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
Register: {
NewAssetDefinition: {
id: "time#looking_glass",
value_type: "Quantity",
mintable: "Once",
// FIXME: remove empty metadata requirement
metadata: {}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
Mint: {
object: "42_u32",
destination_id: {
AssetId: "time##white_rabbit@looking_glass"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
Burn: {
object: "7_u32",
destination_id: {
AssetId: "time##white_rabbit@looking_glass"
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/rust/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Rust examples for Iroha 2

WIP
File renamed without changes.