types

package
v0.0.0-...-3792732 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// INJ defines the default coin denomination used in Ethermint in:
	//
	// - Staking parameters: denomination used as stake in the dPoS chain
	// - Mint parameters: denomination minted due to fee distribution rewards
	// - Governance parameters: denomination used for spam prevention in proposal deposits
	// - Crisis parameters: constant fee denomination used for spam prevention to check broken invariant
	// - EVM parameters: denomination used for running EVM state transitions in Ethermint.
	InjectiveCoin string = "inj"

	// BaseDenomUnit defines the base denomination unit for Photons.
	// 1 photon = 1x10^{BaseDenomUnit} inj
	BaseDenomUnit = 18
)
View Source
const (
	// InjectiveBech32Prefix defines the Bech32 prefix used for EthAccounts on the Injective Chain
	InjectiveBech32Prefix = "inj"

	// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
	Bech32PrefixAccAddr = InjectiveBech32Prefix
	// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
	Bech32PrefixAccPub = InjectiveBech32Prefix + sdk.PrefixPublic
	// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
	Bech32PrefixValAddr = InjectiveBech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator
	// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
	Bech32PrefixValPub = InjectiveBech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic
	// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
	Bech32PrefixConsAddr = InjectiveBech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus
	// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
	Bech32PrefixConsPub = InjectiveBech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic

	// Bip44CoinType satisfies EIP84. See https://github.com/ethereum/EIPs/issues/84 for more info.
	Bip44CoinType = 60
)
View Source
const (
	// DefaultGasPrice is default gas price for evm transactions
	DefaultGasPrice = 0
	// DefaultRPCGasLimit is default gas limit for RPC call operations
	DefaultRPCGasLimit = 80000000
)
View Source
const (
	// RootCodespace is the codespace for all errors defined in this package
	RootCodespace = "injective"
)

Variables

View Source
var (
	ErrInvalidLengthAccount        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAccount          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupAccount = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTxExt        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTxExt          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTxExt = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTxResponse        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTxResponse          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTxResponse = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// BIP44HDPath is the BIP44 HD path used on Ethereum.
	BIP44HDPath = ethaccounts.DefaultBaseDerivationPath.String()
)
View Source
var EmptyCodeHash = ethcrypto.Keccak256(nil)
View Source
var (
	// ErrInvalidChainID returns an error resulting from an invalid chain ID.
	ErrInvalidChainID = errors.Register(RootCodespace, 3, "invalid chain ID")
)

Functions

func CosmosAddressToEthAddress

func CosmosAddressToEthAddress(addr string) (ethcmn.Address, error)

func GenerateRandomChainID

func GenerateRandomChainID() string

GenerateRandomChainID returns a random chain-id in the valid format.

func IsValidChainID

func IsValidChainID(chainID string) bool

IsValidChainID returns false if the given chain identifier is incorrectly formatted.

func MarshalBigInt

func MarshalBigInt(i *big.Int) (string, error)

MarshalBigInt marshals big int into text string for consistent encoding

func NewInjectiveCoin

func NewInjectiveCoin(amount sdkmath.Int) sdk.Coin

NewInjectiveCoin is a utility function that returns an "inj" coin with the given sdkmath.Int amount. The function will panic if the provided amount is negative.

func NewInjectiveCoinInt64

func NewInjectiveCoinInt64(amount int64) sdk.Coin

NewInjectiveCoinInt64 is a utility function that returns an "inj" coin with the given int64 amount. The function will panic if the provided amount is negative.

func NewInjectiveDecCoin

func NewInjectiveDecCoin(amount sdkmath.Int) sdk.DecCoin

NewInjectiveDecCoin is a utility function that returns an "inj" decimal coin with the given sdkmath.Int amount. The function will panic if the provided amount is negative.

func NewThreadsafeInfiniteGasMeter

func NewThreadsafeInfiniteGasMeter() storetypes.GasMeter

NewThreadsafeInfiniteGasMeter returns a reference to a new thread-safe infiniteGasMeter.

func ParseChainID

func ParseChainID(chainID string) (*big.Int, error)

ParseChainID parses a string chain identifier's epoch to an Ethereum-compatible chain-id in *big.Int format. The function returns an error if the chain-id has an invalid format

func ProtoAccount

func ProtoAccount() authtypes.AccountI

ProtoAccount defines the prototype function for BaseAccount used for an AccountKeeper.

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces registers the tendermint concrete client-related implementations and interfaces.

func SetBech32Prefixes

func SetBech32Prefixes(config *sdk.Config)

SetBech32Prefixes sets the global prefixes to be used when serializing addresses and public keys to Bech32 strings.

func SetBip44CoinType

func SetBip44CoinType(config *sdk.Config)

SetBip44CoinType sets the global coin type to be used in hierarchical deterministic wallets.

func UnmarshalBigInt

func UnmarshalBigInt(s string) (*big.Int, error)

UnmarshalBigInt unmarshals string from *big.Int

Types

type Code

type Code []byte

Code is account Code type alias

func (Code) String

func (c Code) String() string

type EthAccount

type EthAccount struct {
	*types.BaseAccount ``     /* 136-byte string literal not displayed */
	CodeHash           []byte `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty" yaml:"code_hash"`
}

EthAccount implements the authtypes.AccountI interface and embeds an authtypes.BaseAccount type. It is compatible with the auth AccountKeeper.

func (*EthAccount) Descriptor

func (*EthAccount) Descriptor() ([]byte, []int)

func (EthAccount) EthAddress

func (acc EthAccount) EthAddress() ethcmn.Address

EthAddress returns the account address ethereum format.

func (*EthAccount) Marshal

func (m *EthAccount) Marshal() (dAtA []byte, err error)

func (EthAccount) MarshalJSON

func (acc EthAccount) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of an EthAccount.

func (*EthAccount) MarshalTo

func (m *EthAccount) MarshalTo(dAtA []byte) (int, error)

func (*EthAccount) MarshalToSizedBuffer

func (m *EthAccount) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (EthAccount) MarshalYAML

func (acc EthAccount) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation of an account.

func (*EthAccount) ProtoMessage

func (*EthAccount) ProtoMessage()

func (*EthAccount) Reset

func (m *EthAccount) Reset()

func (*EthAccount) Size

func (m *EthAccount) Size() (n int)

func (EthAccount) String

func (acc EthAccount) String() string

String implements the fmt.Stringer interface

func (*EthAccount) Unmarshal

func (m *EthAccount) Unmarshal(dAtA []byte) error

func (*EthAccount) UnmarshalJSON

func (acc *EthAccount) UnmarshalJSON(bz []byte) error

UnmarshalJSON unmarshals raw JSON bytes into an EthAccount.

func (*EthAccount) XXX_DiscardUnknown

func (m *EthAccount) XXX_DiscardUnknown()

func (*EthAccount) XXX_Marshal

func (m *EthAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EthAccount) XXX_Merge

func (m *EthAccount) XXX_Merge(src proto.Message)

func (*EthAccount) XXX_Size

func (m *EthAccount) XXX_Size() int

func (*EthAccount) XXX_Unmarshal

func (m *EthAccount) XXX_Unmarshal(b []byte) error

type ExtensionOptionsWeb3Tx

type ExtensionOptionsWeb3Tx struct {
	// typedDataChainID used only in EIP712 Domain and should match
	// Ethereum network ID in a Web3 provider (e.g. Metamask).
	TypedDataChainID uint64 `protobuf:"varint,1,opt,name=typedDataChainID,proto3" json:"typedDataChainID,omitempty"`
	// feePayer is an account address for the fee payer. It will be validated
	// during EIP712 signature checking.
	FeePayer string `protobuf:"bytes,2,opt,name=feePayer,proto3" json:"feePayer,omitempty"`
	// feePayerSig is a signature data from the fee paying account,
	// allows to perform fee delegation when using EIP712 Domain.
	FeePayerSig []byte `protobuf:"bytes,3,opt,name=feePayerSig,proto3" json:"feePayerSig,omitempty"`
}

func (*ExtensionOptionsWeb3Tx) Descriptor

func (*ExtensionOptionsWeb3Tx) Descriptor() ([]byte, []int)

func (*ExtensionOptionsWeb3Tx) Marshal

func (m *ExtensionOptionsWeb3Tx) Marshal() (dAtA []byte, err error)

func (*ExtensionOptionsWeb3Tx) MarshalTo

func (m *ExtensionOptionsWeb3Tx) MarshalTo(dAtA []byte) (int, error)

func (*ExtensionOptionsWeb3Tx) MarshalToSizedBuffer

func (m *ExtensionOptionsWeb3Tx) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ExtensionOptionsWeb3Tx) ProtoMessage

func (*ExtensionOptionsWeb3Tx) ProtoMessage()

func (*ExtensionOptionsWeb3Tx) Reset

func (m *ExtensionOptionsWeb3Tx) Reset()

func (*ExtensionOptionsWeb3Tx) Size

func (m *ExtensionOptionsWeb3Tx) Size() (n int)

func (*ExtensionOptionsWeb3Tx) String

func (m *ExtensionOptionsWeb3Tx) String() string

func (*ExtensionOptionsWeb3Tx) Unmarshal

func (m *ExtensionOptionsWeb3Tx) Unmarshal(dAtA []byte) error

func (*ExtensionOptionsWeb3Tx) XXX_DiscardUnknown

func (m *ExtensionOptionsWeb3Tx) XXX_DiscardUnknown()

func (*ExtensionOptionsWeb3Tx) XXX_Marshal

func (m *ExtensionOptionsWeb3Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ExtensionOptionsWeb3Tx) XXX_Merge

func (m *ExtensionOptionsWeb3Tx) XXX_Merge(src proto.Message)

func (*ExtensionOptionsWeb3Tx) XXX_Size

func (m *ExtensionOptionsWeb3Tx) XXX_Size() int

func (*ExtensionOptionsWeb3Tx) XXX_Unmarshal

func (m *ExtensionOptionsWeb3Tx) XXX_Unmarshal(b []byte) error

type ExtensionOptionsWeb3TxI

type ExtensionOptionsWeb3TxI interface{}

type TxResponseData

type TxResponseData struct {
	Messages []*TxResponseGenericMessage `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
}

improvised message to unpack length prefixed messages in tx response data

func (*TxResponseData) Descriptor

func (*TxResponseData) Descriptor() ([]byte, []int)

func (*TxResponseData) GetMessages

func (m *TxResponseData) GetMessages() []*TxResponseGenericMessage

func (*TxResponseData) Marshal

func (m *TxResponseData) Marshal() (dAtA []byte, err error)

func (*TxResponseData) MarshalTo

func (m *TxResponseData) MarshalTo(dAtA []byte) (int, error)

func (*TxResponseData) MarshalToSizedBuffer

func (m *TxResponseData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TxResponseData) ProtoMessage

func (*TxResponseData) ProtoMessage()

func (*TxResponseData) Reset

func (m *TxResponseData) Reset()

func (*TxResponseData) Size

func (m *TxResponseData) Size() (n int)

func (*TxResponseData) String

func (m *TxResponseData) String() string

func (*TxResponseData) Unmarshal

func (m *TxResponseData) Unmarshal(dAtA []byte) error

func (*TxResponseData) XXX_DiscardUnknown

func (m *TxResponseData) XXX_DiscardUnknown()

func (*TxResponseData) XXX_Marshal

func (m *TxResponseData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TxResponseData) XXX_Merge

func (m *TxResponseData) XXX_Merge(src proto.Message)

func (*TxResponseData) XXX_Size

func (m *TxResponseData) XXX_Size() int

func (*TxResponseData) XXX_Unmarshal

func (m *TxResponseData) XXX_Unmarshal(b []byte) error

type TxResponseGenericMessage

type TxResponseGenericMessage struct {
	Header string `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	Data   []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}

base header ak message type, we can cast the bytes into corresponding message response type

func (*TxResponseGenericMessage) Descriptor

func (*TxResponseGenericMessage) Descriptor() ([]byte, []int)

func (*TxResponseGenericMessage) GetData

func (m *TxResponseGenericMessage) GetData() []byte

func (*TxResponseGenericMessage) GetHeader

func (m *TxResponseGenericMessage) GetHeader() string

func (*TxResponseGenericMessage) Marshal

func (m *TxResponseGenericMessage) Marshal() (dAtA []byte, err error)

func (*TxResponseGenericMessage) MarshalTo

func (m *TxResponseGenericMessage) MarshalTo(dAtA []byte) (int, error)

func (*TxResponseGenericMessage) MarshalToSizedBuffer

func (m *TxResponseGenericMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TxResponseGenericMessage) ProtoMessage

func (*TxResponseGenericMessage) ProtoMessage()

func (*TxResponseGenericMessage) Reset

func (m *TxResponseGenericMessage) Reset()

func (*TxResponseGenericMessage) Size

func (m *TxResponseGenericMessage) Size() (n int)

func (*TxResponseGenericMessage) String

func (m *TxResponseGenericMessage) String() string

func (*TxResponseGenericMessage) Unmarshal

func (m *TxResponseGenericMessage) Unmarshal(dAtA []byte) error

func (*TxResponseGenericMessage) XXX_DiscardUnknown

func (m *TxResponseGenericMessage) XXX_DiscardUnknown()

func (*TxResponseGenericMessage) XXX_Marshal

func (m *TxResponseGenericMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TxResponseGenericMessage) XXX_Merge

func (m *TxResponseGenericMessage) XXX_Merge(src proto.Message)

func (*TxResponseGenericMessage) XXX_Size

func (m *TxResponseGenericMessage) XXX_Size() int

func (*TxResponseGenericMessage) XXX_Unmarshal

func (m *TxResponseGenericMessage) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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