util

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackendFile   = "file"
	BackendMemory = "memory"
)
View Source
const (
	DefaultEvmGasLimit         = "21000"
	DefaultSolidityValue       = "0"
	DefaultEvmTxReceiptTimeout = 100
)

Variables

This section is empty.

Functions

func AbiParsing

func AbiParsing(jsonFilePath string) (string, error)

func Bech32toValidatorAddress

func Bech32toValidatorAddress(validators []string) ([]sdk.ValAddress, error)

func BytecodeParsing

func BytecodeParsing(jsonFilePath string) (string, error)

func ConvertEvmChainId

func ConvertEvmChainId(chainId string) (*big.Int, error)

func CtxHttpClient added in v0.0.5

func CtxHttpClient(methodType string, url string, reqBody []byte, ctx context.Context) ([]byte, error)

Make new http client for inquiring several information.

func DenomAdd

func DenomAdd(amount string) string

func DenomRemove

func DenomRemove(amount string) string

func From0xHexStringToIBignt added in v0.0.6

func From0xHexStringToIBignt(hexString string) *big.Int

func FromBigIntToString

func FromBigIntToString(v *big.Int) string

func FromByte20AddressToCosmosAddr

func FromByte20AddressToCosmosAddr(address common.Address) (sdk.AccAddress, error)

func FromInt64ToString added in v0.0.5

func FromInt64ToString(value int64) string

func FromIntToString

func FromIntToString(value int) string

func FromStringHexToHash

func FromStringHexToHash(hashString string) common.Hash

func FromStringToBigInt

func FromStringToBigInt(v string) (*big.Int, error)

func FromStringToByte20Address

func FromStringToByte20Address(address string) common.Address

func FromStringToInt

func FromStringToInt(value string) int

func FromStringToInt64

func FromStringToInt64(value string) int64

func FromStringToTypeHexString added in v0.0.6

func FromStringToTypeHexString(value string) string

func FromStringToUint64

func FromStringToUint64(value string) uint64

func FromUint64ToString

func FromUint64ToString(value uint64) string

func GasLimitAdjustment

func GasLimitAdjustment(gasUsed uint64, gasAdjustment string) (string, error)

func GetAbiPack added in v0.0.6

func GetAbiPack(callName string, abi string, bytecode string, args ...interface{}) ([]byte, error)

For invoke(as execute) contract, parameters are packed by using ABI.

func GetAbiUnpack added in v0.0.6

func GetAbiUnpack(callName string, abi string, bytecode string, data []byte) ([]interface{}, error)

After call(as query) solidity contract, the response of chain is unpacked by ABI.

func GetAddrByPrivKey

func GetAddrByPrivKey(priv cryptotypes.PrivKey) (sdk.AccAddress, error)

func GetBindMetaData added in v0.0.7

func GetBindMetaData(abi, bytecode string) *bind.MetaData

func GrpcUrlParsing

func GrpcUrlParsing(normalUrl string) string

func JsonMarshalData

func JsonMarshalData(jsonData interface{}) ([]byte, error)

func JsonMarshalDataIndent added in v0.0.6

func JsonMarshalDataIndent(jsonData interface{}) ([]byte, error)

func JsonUnmarshal

func JsonUnmarshal(jsonStruct interface{}, jsonFilePath string) (interface{}, error)

func JsonUnmarshalData

func JsonUnmarshalData(jsonStruct interface{}, byteValue []byte) interface{}

func LogErr

func LogErr(errType xgoerrors.XGoError, errDesc ...interface{}) error

func LogInfo

func LogInfo(log ...interface{})

func MakeEncodingConfig added in v0.0.2

func MakeEncodingConfig() params.EncodingConfig

func MakeQueryLabels added in v0.0.5

func MakeQueryLabels(labels ...string) string

func MakeQueryLcdUrl added in v0.0.5

func MakeQueryLcdUrl(metadata string) string

func MulBigInt added in v0.0.3

func MulBigInt(val1 *big.Int, val2 *big.Int) *big.Int

func MulUint64

func MulUint64(val1 uint64, val2 uint64) uint64

func NewClient

func NewClient() (cmclient.Context, error)

Provide cosmos sdk client.

func NewFactory

func NewFactory(clientCtx cmclient.Context) tx.Factory

Provide cosmos sdk tx factory.

func NewKeyring

func NewKeyring(backendType string, keyringPath string) (keyring.Keyring, error)

Provide cosmos sdk keyring

func SaveJsonPretty

func SaveJsonPretty(jsonByte []byte, saveTxPath string) error

func ToString

func ToString(value interface{}, defaultValue string) string

func ToStringTrim added in v0.0.6

func ToStringTrim(value interface{}, defaultValue string) string

Types

type EvmClient added in v0.0.2

type EvmClient struct {
	Ctx       context.Context
	Client    *ethclient.Client
	RpcClient *erpc.Client
}

func NewEvmClient added in v0.0.2

func NewEvmClient(evmRpcUrl string, ctx context.Context) (*EvmClient, error)

Make new evm client using RPC URL which normally TCP port number is 8545. It supports that sending transaction, contract deployment, executing/querying contract and etc.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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