Skip to content

UseCases_tokens_Token balance

BytzCK edited this page Nov 23, 2021 · 1 revision

Use Cases, Scenario’s, Walkthroughts - for tokens

Case "Token balances"

Scenario: Perform basic operations with tokens

Feature: View token balance

Actor: Any user

Summary:

The wallet's per-token balance can be retrieved with the command: token balance (TOKENGROUPID) (BYTZADDRESS). If a wallet contains token authorities, the per-token total set of authorities is included in the output. the total of the token authorities available in the wallet. The list can be limited by tokengroup or by tokengroup and BYTZ address.

Preconditions:

No preconditions.

Steps:

To show all tokens in a wallet, use the following command:

$ gettokenbalance
[
  {
    "groupID": "bytzreg1zw0tzp0x05szcvhq68gyh9d6v5zhc652q2r8al8dk3r8vauxj3vqsxstc84",
    "ticker": "GVT",
    "name": "GuardianValidator",
    "balance": "71",
    "authorities": "mint melt child rescript subgroup configure"
  },
  {
    "groupID": "bytzreg1zd4077w2tk2ct4wqfd4er3esasgxmvkeehknwumrea4h0tx3nz7sqta2cgp",
    "ticker": "RTTOK",
    "name": "RegtestToken",
    "balance": "10000",
    "authorities": "mint melt child rescript subgroup configure"
  },
  {
    "groupID": "bytzreg1zvjns3w2h5mxcz3pg24whdyhygkcdgerqjzk86n7uzfu6u8nry3qsuwdydt",
    "ticker": "MGT",
    "name": "Management",
    "balance": "500.0000",
    "authorities": "mint melt child rescript subgroup configure"
  }
]
This wallet holds 500 MGT, 71 GVT, full authority RTTOK, and balance of 100000 RTTOK

If you want to retrieve the token group info connected to the tokengroup ID returned by the token balance command, use the tokeninfo groupid command:

$ tokeninfo groupid bytzreg1zw0tzp0x05szcvhq68gyh9d6v5zhc652q2r8al8dk3r8vauxj3vqsxstc84
[
  {
    "groupID": "bytzreg1zw0tzp0x05szcvhq68gyh9d6v5zhc652q2r8al8dk3r8vauxj3vqsxstc84",
    "flags": "management",
    "specification": {
      "ticker": "GVT",
      "name": "GuardianValidator",
      "metadata_url": "https://github.com/bytzcurrency/ATP-descriptions/blob/master/BYTZ-regtest-GVT.json",
      "metadata_hash": "f5125a90bde180ef073ce1109376d977f5cbddb5582643c81424cc6cc842babd",
      "decimal_pos": 0,
      "bls_pubkey": "97c40d3489a6109b355a241cfc17863b935f84b6c435c649c6790bbec64b757553885a1cd9ccf22bad67ff04484a1df6"
    }
  }
]

To retrieve only the balance of a specific group, specify the tokengroup ID as a parameter as follows:

$ gettokenbalance bytzreg1zw0tzp0x05szcvhq68gyh9d6v5zhc652q2r8al8dk3r8vauxj3vqsxstc84
{
  "groupID": "bytzreg1zw0tzp0x05szcvhq68gyh9d6v5zhc652q2r8al8dk3r8vauxj3vqsxstc84",
  "balance": "71",
  "authorities": "mint melt child rescript subgroup configure"
}

To retrieve only the balance of a specific group at a specific address, specify both parameters:

$ gettokenbalance bytzreg1zw0tzp0x05szcvhq68gyh9d6v5zhc652q2r8al8dk3r8vauxj3vqsxstc84 TkhfncwgMnzDqD4W14UVLgYxebuUbWuHWm
{
  "groupID": "bytzreg1zw0tzp0x05szcvhq68gyh9d6v5zhc652q2r8al8dk3r8vauxj3vqsxstc84",
  "balance": "71"
}

Postconditions:

  • An overview of available tokens and token authorities is displayed

Related use cases:

Clone this wiki locally