laconic-registry-cli/test
Thomas E Lackey c67961869b
All checks were successful
Lint / lint (18.x) (push) Successful in 1m8s
Tests / cli_tests (18.x) (push) Successful in 8m48s
927: Add gettx command and have send command return the tx hash. (#78)
To support cerc-io/stack-orchestrator#927, add a new token command `gettx` to inspect a previous transaction, and adjust the output of `send` to include the tx details.

For example:

```
❯ laconic registry tokens send --address laconic1yqpc7cyfetpgmqtkk0ukevugeaau9p0cwmjlsu --type alnt --quantity 1000
{
  "tx": {
    "hash": "977152CBE474613E1BBAFEF286F12134829FAF3C9E7C8349149DE3E687B816FC",
    "height": 343369,
    "index": 0,
    "code": 0,
    "log": "",
    "sender": "laconic14wc07wa3r7rppru43g9jxkzhqnhmvfm4dgey6s",
    "recipient": "laconic1yqpc7cyfetpgmqtkk0ukevugeaau9p0cwmjlsu",
    "amount": "1000alnt"
  },
  "accounts": [
    {
      "address": "laconic14wc07wa3r7rppru43g9jxkzhqnhmvfm4dgey6s",
      "pubKey": "AvOh0Hdjj5/YKMTPEm/oLgvpg4gIP1vB4d1NhBMq6/+B",
      "number": 3,
      "sequence": 91,
      "balance": [
        {
          "type": "alnt",
          "quantity": 1.2899999999709944e+22
        }
      ]
    },
    {
      "address": "laconic1yqpc7cyfetpgmqtkk0ukevugeaau9p0cwmjlsu",
      "pubKey": "A7XYVHLemQYUjXe6VnSDlcyzLnpdJ8CE8zvDiZtgxqnT",
      "number": 1,
      "sequence": 1,
      "balance": [
        {
          "type": "alnt",
          "quantity": 1.289999999991e+22
        }
      ]
    }
  ]
}
```

```
❯ laconic registry tokens gettx --hash 977152CBE474613E1BBAFEF286F12134829FAF3C9E7C8349149DE3E687B816FC
{
  "hash": "977152CBE474613E1BBAFEF286F12134829FAF3C9E7C8349149DE3E687B816FC",
  "height": 343369,
  "index": 0,
  "code": 0,
  "log": "",
  "sender": "laconic14wc07wa3r7rppru43g9jxkzhqnhmvfm4dgey6s",
  "recipient": "laconic1yqpc7cyfetpgmqtkk0ukevugeaau9p0cwmjlsu",
  "amount": "1000alnt",
  "raw": "0A91010A8E010A1C2F636F736D6F732E62616E6B2E763162657461312E4D736753656E64126E0A2E6C61636F6E696331347763303777613372377270707275343367396A786B7A68716E686D76666D34646765793673122E6C61636F6E6963317971706337637966657470676D71746B6B30756B657675676561617539703063776D6A6C73751A0C0A04616C6E7412043130303012680A500A460A1F2F636F736D6F732E63727970746F2E736563703235366B312E5075624B657912230A2102F3A1D077638F9FD828C4CF126FE82E0BE98388083F5BC1E1DD4D84132AEBFF8112040A020801185A12140A0E0A04616C6E7412063430303030301080B5181A4088DF7BA4B63EA68E185AB2887C9EC29EBC4158874BC037816B8494AD36D3B2433B5223CECC336D4624BB7FEF4DBB4A8B5F4707ACD8E55443312009E9473DF821"
}
```

Reviewed-on: #78
Reviewed-by: David Boreham <dboreham@noreply.git.vdb.to>
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2024-08-20 03:19:48 +00:00
..
data Add CLI tests and setup CI (#53) 2024-01-29 04:46:32 +00:00
cli.test.ts 927: Add gettx command and have send command return the tx hash. (#78) 2024-08-20 03:19:48 +00:00
helpers.ts Replace photon with alnt token denom (#73) 2024-07-30 13:24:46 +00:00
README.md Rename laconic2d to laconicd and upgrade SDK (#61) 2024-04-02 13:25:31 +00:00
run-tests.sh Replace photon with alnt token denom (#73) 2024-07-30 13:24:46 +00:00

Run CLI tests

  • Follow the project Setup and Account Setup from root README

  • Add laconic cmd to path

    export PATH="$PWD/bin:$PATH"
    
  • Create a .env file using .env.example:

    cp .env.example .env
    
  • Get account address of test account:

    laconicd keys list --keyring-backend test
    
    # - address: laconic10er85pyd7ukw732e88fzv7k0jq205764hye2dx
    #   name: alice
    #   pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AsDoWlNIr3W013pOiwmopaB/SaWQj6r3g56xb2d9GxYK"}'
    #   type: local
    

    Use the address field from the result and assign it in TEST_ACCOUNT field of .env file

  • Run CLI tests:

    yarn test