types

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 23 Imported by: 8

Documentation

Index

Constants

View Source
const (
	EventTypeEthereumTx = "ethereum_tx"
	EventTypeBlockBloom = "block_bloom"
	EventTypeTxLog      = "tx_log"

	AttributeKeyContractAddress = "contract"
	AttributeKeyRecipient       = "recipient"
	AttributeKeyTxHash          = "txHash"
	AttributeKeyEthereumTxHash  = "ethereumTxHash"
	AttributeKeyTxIndex         = "txIndex"
	AttributeKeyTxGasUsed       = "txGasUsed"
	AttributeKeyTxType          = "txType"
	AttributeKeyTxLog           = "txLog"

	AttributeKeyEthereumTxFailed = "ethereumTxFailed"
	AttributeValueCategory       = "evm"
	AttributeKeyEthereumBloom    = "bloom"

	MetricKeyTransitionDB = "transition_db"
	MetricKeyStaticCall   = "static_call"
)
View Source
const (
	ChainTypeDefault  = "cosmos"
	ChainTypeEvm      = "evm"
	ChainTypeCosmWasm = "wasm"
)

Variables

View Source
var (
	ErrBadRequest              = status.Error(codes.InvalidArgument, "bad request")
	ErrBadPageSize             = status.Error(codes.InvalidArgument, "bad page size")
	ErrBadPageNo               = status.Error(codes.InvalidArgument, "bad page number")
	ErrNotSupportedMessageType = status.Error(codes.Unimplemented, "message parser not found")
	ErrBadAddress              = status.Error(codes.InvalidArgument, "bad address")
)
View Source
var (
	EvmEvent_Erc20_Erc721_Transfer = common.HexToHash(
		"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
	) // Keccak-256 Transfer(address,address,uint256)
	EvmEvent_Erc20_Erc721_Approval = common.HexToHash(
		"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
	) // Keccak-256 Approval(address,address,uint256)
	EvmEvent_Erc721_Erc1155_ApprovalForAll = common.HexToHash(
		"0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31",
	) // Keccak-256 ApprovalForAll(address,address,bool)
	EvmEvent_Erc1155_TransferSingle = common.HexToHash(
		"0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62",
	) // Keccak-256 TransferSingle(address,address,address,uint256,uint256)
	EvmEvent_Erc1155_TransferBatch = common.HexToHash(
		"0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb",
	) // Keccak-256 TransferBatch(address,address,address,uint256[],uint256[])
	EvmEvent_WDeposit = common.HexToHash(
		"0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
	) // Deposit(address indexed user,uint256 amount)
	EvmEvent_WWithdraw = common.HexToHash(
		"0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65",
	) // Withdrawal(address indexed src,uint256 wad)
)

Functions

This section is empty.

Types

type Bech32Config

type Bech32Config struct {
	// contains filtered or unexported fields
}

func NewBech32Config

func NewBech32Config() Bech32Config

func (Bech32Config) ConvertToAccAddressIfHexOtherwiseKeepAsIs

func (m Bech32Config) ConvertToAccAddressIfHexOtherwiseKeepAsIs(addr string) string

func (Bech32Config) FromAnyToBech32AccountAddrUnsafe

func (m Bech32Config) FromAnyToBech32AccountAddrUnsafe(addr string) string

func (Bech32Config) GetBech32AccountAddrPrefix

func (m Bech32Config) GetBech32AccountAddrPrefix() string

func (Bech32Config) GetBech32ConsensusAddrPrefix

func (m Bech32Config) GetBech32ConsensusAddrPrefix() string

func (Bech32Config) GetBech32ValidatorAddrPrefix

func (m Bech32Config) GetBech32ValidatorAddrPrefix() string

func (Bech32Config) IsAccountAddr

func (m Bech32Config) IsAccountAddr(addr string) bool

func (Bech32Config) IsConsAddr

func (m Bech32Config) IsConsAddr(addr string) bool

func (Bech32Config) IsValAddr

func (m Bech32Config) IsValAddr(addr string) bool

type ContractAddress added in v1.1.0

type ContractAddress string

type ExpectedEVMTxIndexer

type ExpectedEVMTxIndexer interface {
	LastIndexedBlock() (int64, error)

	// GetByTxHashForExternal returns nil if tx not found.
	GetByTxHashForExternal(common.Hash) (TxResultForExternal, error)

	// GetIndexer returns the indexer instance.
	GetIndexer() any
}

ExpectedEVMTxIndexer defines the interface of custom eth tx indexer.

type ExternalServices

type ExternalServices struct {
	ChainType    string
	EvmTxIndexer ExpectedEVMTxIndexer
}

type FakeBaseAccount

type FakeBaseAccount struct {
	Address       string `json:"address"`
	AccountNumber uint64 `json:"account_number,string"`
	Sequence      uint64 `json:"sequence,string"`
}

FakeBaseAccount is fake version of x/auth BaseAccount. With ability to marshal and unmarshal.

func (*FakeBaseAccount) TryUnmarshalFromProto

func (m *FakeBaseAccount) TryUnmarshalFromProto(protoAccount *codectypes.Any, codec codec.Codec) (success bool, err error)

type FriendlyResponseContentBuilderI

type FriendlyResponseContentBuilderI interface {
	WriteText(string) FriendlyResponseContentBuilderI
	WriteAddress(string) FriendlyResponseContentBuilderI
	WriteCoins(coins sdk.Coins, denomsMetadata map[string]banktypes.Metadata) FriendlyResponseContentBuilderI

	Build() (friendlySimple string, friendlyMachine string)
	BuildIntoResponse(res GenericBackendResponse)
}

func NewFriendlyResponseContentBuilder

func NewFriendlyResponseContentBuilder() FriendlyResponseContentBuilderI

type GenericBackendResponse

type GenericBackendResponse map[string]any

GenericBackendResponse is the generic format for the backend response.

func NewGenericBackendResponseFrom

func NewGenericBackendResponseFrom(v any) (res GenericBackendResponse, err error)

func (GenericBackendResponse) ReInitializeIfNil

func (m GenericBackendResponse) ReInitializeIfNil() GenericBackendResponse

type InvolversType

type InvolversType string
const (
	MessageSenderSigner InvolversType = "s"
	MessageInvolvers    InvolversType = "0"
	Erc20Involvers      InvolversType = "erc20"
	NftInvolvers        InvolversType = "nft"
	ContractsInvolvers  InvolversType = "contracts"
)

type MessageContractsInvolvers added in v1.1.0

type MessageContractsInvolvers map[InvolversType]MessageContractsInvolversByType

type MessageContractsInvolversByType added in v1.1.0

type MessageContractsInvolversByType map[ContractAddress][]string

type MessageGenericInvolvers added in v1.1.0

type MessageGenericInvolvers map[InvolversType][]string

type MessageInvolversExtractor

type MessageInvolversExtractor func(msg sdk.Msg, tx *tx.Tx, tmTx tmtypes.Tx, clientCtx client.Context) (MessageInvolversResult, error)

type MessageInvolversResult

type MessageInvolversResult interface {
	Merge(other MessageInvolversResult)
	AddGenericInvolvers(t InvolversType, addresses ...string)
	AddContractInvolvers(t InvolversType, contractAddr ContractAddress, addresses ...string)
	Finalize()
	ToResponseObject() any

	GenericInvolvers() MessageGenericInvolvers
	ContractsInvolvers() MessageContractsInvolvers
}

func NewMessageInvolversResult added in v1.1.0

func NewMessageInvolversResult() MessageInvolversResult

type MessageParser

type MessageParser func(msg sdk.Msg, msgIdx uint, tx *tx.Tx, txResponse *sdk.TxResponse) (GenericBackendResponse, error)

type QueryClient

type QueryClient struct {
	tx.ServiceClient

	BankQueryClient         banktypes.QueryClient
	StakingQueryClient      stakingtypes.QueryClient
	DistributionQueryClient disttypes.QueryClient
	GovV1QueryClient        govv1types.QueryClient
	MintQueryClient         minttypes.QueryClient
	AuthQueryClient         authtypes.QueryClient
}

QueryClient defines a gRPC Client used for:

  • Transaction simulation

func NewQueryClient

func NewQueryClient(clientCtx client.Context) *QueryClient

NewQueryClient creates a new gRPC query client

type RpcDenomMetadata

type RpcDenomMetadata struct {
	// denom_units represents the list of DenomUnit's for a given coin
	DenomUnits []RpcDenomMetadataUnit `json:"denomUnits,omitempty"`
	// base represents the base denom (should be the DenomUnit with exponent = 0).
	Base string `json:"base"`
	// name defines the name of the token (eg: Cosmos Atom)
	Name string `json:"name"`
	// symbol is the token symbol usually shown on exchanges (eg: ATOM). This can
	// be the same as the display.
	Symbol string `json:"symbol"`

	// Highest exponent is an additional field to the metadata that is used to represent the highest available exponent
	// among all the denom units. This is used to determine the precision of the token.
	HighestExponent uint32 `json:"highestExponent"`
}

func NewRpcDenomMetadataFromBankMetadata

func NewRpcDenomMetadataFromBankMetadata(metadata banktypes.Metadata) RpcDenomMetadata

type RpcDenomMetadataUnit

type RpcDenomMetadataUnit struct {
	// denom represents the string name of the given denom unit (e.g uatom).
	Denom string `json:"denom,omitempty"`
	// exponent represents power of 10 exponent that one must
	// raise the base_denom to in order to equal the given DenomUnit's denom
	// 1 denom = 10^exponent base_denom
	// (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with
	// exponent = 6, thus: 1 atom = 10^6 uatom).
	Exponent uint32 `json:"exponent"`
}

type Tracker

type Tracker[T constraints.Ordered] map[T]bool

func (Tracker[T]) Add

func (m Tracker[T]) Add(value T)

func (Tracker[T]) Has

func (m Tracker[T]) Has(value T) bool

func (Tracker[T]) ToSlice

func (m Tracker[T]) ToSlice() []T

func (Tracker[T]) ToSortedSlice

func (m Tracker[T]) ToSortedSlice() []T

type TxEvent

type TxEvent struct {
	Type       string             `json:"type,omitempty"`
	Attributes []TxEventAttribute `json:"attributes,omitempty"`
}

type TxEventAttribute

type TxEventAttribute struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

type TxEvents

type TxEvents []TxEvent

func ConvertTxEvent

func ConvertTxEvent(events []abci.Event) TxEvents

func (TxEvents) RemoveUnnecessaryEvmTxEvents

func (m TxEvents) RemoveUnnecessaryEvmTxEvents() TxEvents

type TxResultForExternal

type TxResultForExternal interface {
	GetHeight() int64
	GetTxIndex() uint32
	GetMsgIndex() uint32
	GetEthTxIndex() int32
	GetFailed() bool
	GetGasUsed() uint64
	GetCumulativeGasUsed() uint64
}

Jump to

Keyboard shortcuts

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