types

package
v0.0.0-...-ea6fe57 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: Apache-2.0 Imports: 20 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 (
	// InjectiveEvmBech32Prefix defines the Bech32 prefix used for EthAccounts on the Injective Chain
	InjectiveEvmBech32Prefix = "inj"

	// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
	Bech32PrefixAccAddr = InjectiveEvmBech32Prefix
	// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
	Bech32PrefixAccPub = InjectiveEvmBech32Prefix + sdk.PrefixPublic
	// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
	Bech32PrefixValAddr = InjectiveEvmBech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator
	// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
	Bech32PrefixValPub = InjectiveEvmBech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic
	// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
	Bech32PrefixConsAddr = InjectiveEvmBech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus
	// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
	Bech32PrefixConsPub = InjectiveEvmBech32Prefix + 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 (
	// ErrInvalidValue returns an error resulting from an invalid value.
	ErrInvalidValue = sdkerrors.Register(RootCodespace, 2, "invalid value")

	// ErrInvalidChainID returns an error resulting from an invalid chain ID.
	ErrInvalidChainID = sdkerrors.Register(RootCodespace, 3, "invalid chain ID")

	// ErrVMExecution returns an error resulting from an error in EVM execution.
	ErrVMExecution = sdkerrors.Register(RootCodespace, 4, "error while executing evm transaction")
)
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 (
	// BIP44HDPath is the BIP44 HD path used on Ethereum.
	BIP44HDPath = ethaccounts.DefaultBaseDerivationPath.String()
)

Functions

func CosmosAddressToEthAddress

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

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 sdk.Int) sdk.Coin

NewInjectiveCoin is a utility function that returns an "inj" coin with the given sdk.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 sdk.Int) sdk.DecCoin

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

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"`
}

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{}

Jump to

Keyboard shortcuts

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