utils

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Example (RespChainInfo_json)
display.Print(&respChainInfo{
	&types.ChainInfo{
		ChainID:     "kwil-chain",
		BlockHeight: 100,
		BlockHash:   mustUnmarshalHash("0000beefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeef"),
		Gas:         true,
	},
}, nil, "json")
Output:

{
  "result": {
    "chain_id": "kwil-chain",
    "block_height": 100,
    "block_hash": "0000beefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeef",
    "gas": true
  },
  "error": ""
}
Example (RespChainInfo_text)
display.Print(&respChainInfo{
	&types.ChainInfo{
		ChainID:     "kwil-chain",
		BlockHeight: 100,
		BlockHash:   mustUnmarshalHash("0000beefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeef"),
		Gas:         true,
	},
}, nil, "text")
Output:

Chain ID: kwil-chain
Height: 100
Hash: 0000beefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeef
Gas: true
Example (RespKwilCliConfig_json)
pk, _, err := crypto.GenerateSecp256k1Key(nil)
if err != nil {
	panic(err)
}

display.Print(&respKwilCliConfig{
	cfg: &config.KwilCliConfig{
		PrivateKey: pk.(*crypto.Secp256k1PrivateKey),
		ChainID:    "chainid123",
		Provider:   "localhost:9090",
	},
}, nil, "json")
Output:

{
  "result": {
    "private_key": "***",
    "provider": "localhost:9090",
    "chain_id": "chainid123"
  },
  "error": ""
}
Example (RespKwilCliConfig_text)
pk, _, err := crypto.GenerateSecp256k1Key(nil)
if err != nil {
	panic(err)
}

display.Print(&respKwilCliConfig{
	cfg: &config.KwilCliConfig{
		PrivateKey: pk.(*crypto.Secp256k1PrivateKey),
		ChainID:    "chainid123",
		Provider:   "localhost:9090",
	},
}, nil, "text")
Output:

PrivateKey: ***
Provider: localhost:9090
ChainID: chainid123

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmdUtils

func NewCmdUtils() *cobra.Command

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL