harmony

package
v0.0.0-...-388dd38 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodGetFullHeader  = "hmyv2_getFullHeader"
	MethodEpochLastBlock = "hmyv2_epochLastBlock"
	MethodGetEpoch       = "hmyv2_getEpoch"
	MethodCall           = "hmyv2_call"
)
View Source
const AccountStorageRootIndex = 2

Variables

View Source
var (
	ErrInvalidLengthConfig        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowConfig          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupConfig = fmt.Errorf("proto: unexpected end of group")
)

Functions

func NewETHClient

func NewETHClient(endpoint string) (*ethclient.Client, error)

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces register the module interfaces to protobuf Any.

Types

type Chain

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

func NewChain

func NewChain(config ChainConfig) (*Chain, error)

func (*Chain) CallOpts

func (chain *Chain) CallOpts(ctx context.Context, height int64) *bind.CallOpts

if height <= 0, get the latest result

func (*Chain) ChainID

func (c *Chain) ChainID() string

ChainID returns ID of the chain

func (*Chain) Codec

func (c *Chain) Codec() codec.ProtoCodecMarshaler

Marshaler returns the marshaler

func (*Chain) ErrCantSetPath

func (c *Chain) ErrCantSetPath(err error) error

ErrCantSetPath returns an error if the path doesn't set properly

func (*Chain) GetAddress

func (c *Chain) GetAddress() (sdk.AccAddress, error)

GetAddress returns the address of relayer

func (*Chain) GetLatestHeight

func (c *Chain) GetLatestHeight() (int64, error)

GetLatestHeight gets the chain for the latest height and returns it

func (*Chain) Init

func (c *Chain) Init(homePath string, timeout time.Duration, codec codec.ProtoCodecMarshaler, debug bool) error

Init ...

func (*Chain) Path

func (c *Chain) Path() *core.PathEnd

func (*Chain) QueryBalance

func (c *Chain) QueryBalance(address sdk.AccAddress) (sdk.Coins, error)

QueryBalance returns the amount of coins in the relayer account

func (*Chain) QueryBankBalance

func (c *Chain) QueryBankBalance(address common.Address, id string) (*big.Int, error)

func (*Chain) QueryChannel

func (c *Chain) QueryChannel(height int64) (chanRes *chantypes.QueryChannelResponse, err error)

QueryChannel returns the channel associated with a channelID

func (*Chain) QueryClientConsensusState

func (c *Chain) QueryClientConsensusState(height int64, dstClientConsHeight ibcexported.Height) (*clienttypes.QueryConsensusStateResponse, error)

QueryClientConsensusState retrevies the latest consensus state for a client in state at a given height

func (*Chain) QueryClientState

func (c *Chain) QueryClientState(height int64) (*clienttypes.QueryClientStateResponse, error)

QueryClientState returns the client state of dst chain height represents the height of dst chain

func (*Chain) QueryConnection

func (c *Chain) QueryConnection(height int64) (*conntypes.QueryConnectionResponse, error)

QueryConnection returns the remote end of a given connection

func (*Chain) QueryDenomTraces

func (c *Chain) QueryDenomTraces(offset uint64, limit uint64, height int64) (*transfertypes.QueryDenomTracesResponse, error)

QueryDenomTraces returns all the denom traces from a given chain

func (*Chain) QueryPacket

func (c *Chain) QueryPacket(height int64, sequence uint64) (*chantypes.Packet, error)

QueryPacket returns the packet corresponding to a sequence

func (*Chain) QueryPacketAcknowledgement

func (c *Chain) QueryPacketAcknowledgement(height int64, sequence uint64) ([]byte, error)

QueryPacketAcknowledgement returns the acknowledgement corresponding to a sequence

func (*Chain) QueryPacketAcknowledgementCommitment

func (c *Chain) QueryPacketAcknowledgementCommitment(height int64, seq uint64) (ackRes *chantypes.QueryPacketAcknowledgementResponse, err error)

QueryPacketAcknowledgementCommitment returns the acknowledgement corresponding to a given sequence

func (*Chain) QueryPacketAcknowledgementCommitments

func (c *Chain) QueryPacketAcknowledgementCommitments(offset uint64, limit uint64, height int64) (comRes *chantypes.QueryPacketAcknowledgementsResponse, err error)

QueryPacketAcknowledgementCommitments returns an array of packet acks

func (*Chain) QueryPacketCommitment

func (c *Chain) QueryPacketCommitment(height int64, seq uint64) (comRes *chantypes.QueryPacketCommitmentResponse, err error)

QueryPacketCommitment returns the packet commitment corresponding to a given sequence

func (*Chain) QueryPacketCommitments

func (c *Chain) QueryPacketCommitments(offset uint64, limit uint64, height int64) (comRes *chantypes.QueryPacketCommitmentsResponse, err error)

NOTE: The current implementation returns all packets, including those for that acknowledgement has already received. QueryPacketCommitments returns an array of packet commitments

func (*Chain) QueryTokenBalance

func (c *Chain) QueryTokenBalance(address common.Address) (*big.Int, error)

func (*Chain) QueryUnrecievedAcknowledgements

func (c *Chain) QueryUnrecievedAcknowledgements(height int64, seqs []uint64) ([]uint64, error)

QueryUnrecievedAcknowledgements returns a list of unrelayed packet acks

func (*Chain) QueryUnrecievedPackets

func (c *Chain) QueryUnrecievedPackets(height int64, seqs []uint64) ([]uint64, error)

QueryUnrecievedPackets returns a list of unrelayed packet commitments

func (*Chain) Send

func (c *Chain) Send(msgs []sdk.Msg) bool

Send sends msgs to the chain and logging a result of it It returns a boolean value whether the result is success

func (*Chain) SendMsgs

func (c *Chain) SendMsgs(msgs []sdk.Msg) ([]byte, error)

SendMsgs sends msgs to the chain

func (*Chain) SetPath

func (c *Chain) SetPath(p *core.PathEnd) error

SetPath sets the path and validates the identifiers

func (*Chain) StartEventListener

func (c *Chain) StartEventListener(dst core.ChainI, strategy core.StrategyI)

StartEventListener ...

func (*Chain) TxAcknowledgement

func (c *Chain) TxAcknowledgement(msg *chantypes.MsgAcknowledgement) (*harmonytypes.Transaction, error)

func (*Chain) TxChannelOpenAck

func (c *Chain) TxChannelOpenAck(msg *chantypes.MsgChannelOpenAck) (*harmonytypes.Transaction, error)

func (*Chain) TxChannelOpenConfirm

func (c *Chain) TxChannelOpenConfirm(msg *chantypes.MsgChannelOpenConfirm) (*harmonytypes.Transaction, error)

func (*Chain) TxChannelOpenInit

func (c *Chain) TxChannelOpenInit(msg *chantypes.MsgChannelOpenInit) (*harmonytypes.Transaction, error)

func (*Chain) TxChannelOpenTry

func (c *Chain) TxChannelOpenTry(msg *chantypes.MsgChannelOpenTry) (*harmonytypes.Transaction, error)

func (*Chain) TxConnectionOpenAck

func (c *Chain) TxConnectionOpenAck(msg *conntypes.MsgConnectionOpenAck) (*harmonytypes.Transaction, error)

func (*Chain) TxConnectionOpenConfirm

func (c *Chain) TxConnectionOpenConfirm(msg *conntypes.MsgConnectionOpenConfirm) (*harmonytypes.Transaction, error)

func (*Chain) TxConnectionOpenInit

func (c *Chain) TxConnectionOpenInit(msg *conntypes.MsgConnectionOpenInit) (*harmonytypes.Transaction, error)

func (*Chain) TxConnectionOpenTry

func (c *Chain) TxConnectionOpenTry(msg *conntypes.MsgConnectionOpenTry) (*harmonytypes.Transaction, error)

func (*Chain) TxCreateClient

func (c *Chain) TxCreateClient(msg *clienttypes.MsgCreateClient) (*harmonytypes.Transaction, error)

func (*Chain) TxMsgTransfer

func (c *Chain) TxMsgTransfer(msg *transfertypes.MsgTransfer) (*harmonytypes.Transaction, error)

func (*Chain) TxRecvPacket

func (c *Chain) TxRecvPacket(msg *chantypes.MsgRecvPacket) (*harmonytypes.Transaction, error)

func (*Chain) TxUpdateClient

func (c *Chain) TxUpdateClient(msg *clienttypes.MsgUpdateClient) (*harmonytypes.Transaction, error)

type ChainConfig

type ChainConfig struct {
	ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	// human name of a chain-id
	HarmonyChainId string `protobuf:"bytes,2,opt,name=harmony_chain_id,json=harmonyChainId,proto3" json:"harmony_chain_id,omitempty"`
	ShardId        uint32 `protobuf:"varint,3,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"`
	ShardRpcAddr   string `protobuf:"bytes,4,opt,name=shard_rpc_addr,json=shardRpcAddr,proto3" json:"shard_rpc_addr,omitempty"`
	// if shard_id = 0, set the same address as shard_rpc_addr
	BeaconRpcAddr string `protobuf:"bytes,5,opt,name=beacon_rpc_addr,json=beaconRpcAddr,proto3" json:"beacon_rpc_addr,omitempty"`
	// use for relayer
	ShardPrivateKey string `protobuf:"bytes,6,opt,name=shard_private_key,json=shardPrivateKey,proto3" json:"shard_private_key,omitempty"`
	// if shard_id = 0, set the same key as shard_private_key
	BeaconPrivateKey string `protobuf:"bytes,7,opt,name=beacon_private_key,json=beaconPrivateKey,proto3" json:"beacon_private_key,omitempty"`
	IbcHostAddress   string `protobuf:"bytes,8,opt,name=ibc_host_address,json=ibcHostAddress,proto3" json:"ibc_host_address,omitempty"`
	// for convenience of demonstration
	IbcHandlerAddress string `protobuf:"bytes,9,opt,name=ibc_handler_address,json=ibcHandlerAddress,proto3" json:"ibc_handler_address,omitempty"`
	// for convenience of demonstration
	Ics20BankAddress string `protobuf:"bytes,10,opt,name=ics20_bank_address,json=ics20BankAddress,proto3" json:"ics20_bank_address,omitempty"`
	// for convenience of demonstration
	Ics20TransferBankAddress string `` /* 138-byte string literal not displayed */
	// for convenience of demonstration
	TokenAddress string `protobuf:"bytes,12,opt,name=token_address,json=tokenAddress,proto3" json:"token_address,omitempty"`
	GasLimit     uint64 `protobuf:"varint,13,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"`
	GasPrice     int64  `protobuf:"varint,14,opt,name=gas_price,json=gasPrice,proto3" json:"gas_price,omitempty"`
}

func (ChainConfig) Build

func (c ChainConfig) Build() (core.ChainI, error)

func (ChainConfig) ChainID

func (c ChainConfig) ChainID() (*sdkcommon.ChainID, error)

func (*ChainConfig) Descriptor

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

func (ChainConfig) GasPriceDec

func (c ChainConfig) GasPriceDec() numeric.Dec

func (ChainConfig) IBCHandlerAddress

func (c ChainConfig) IBCHandlerAddress() common.Address

func (ChainConfig) IBCHostAddress

func (c ChainConfig) IBCHostAddress() common.Address

func (ChainConfig) ICS20BankAddress

func (c ChainConfig) ICS20BankAddress() common.Address

func (*ChainConfig) Marshal

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

func (*ChainConfig) MarshalTo

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

func (*ChainConfig) MarshalToSizedBuffer

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

func (*ChainConfig) ProtoMessage

func (*ChainConfig) ProtoMessage()

func (*ChainConfig) Reset

func (m *ChainConfig) Reset()

func (ChainConfig) SimpleTokenAddress

func (c ChainConfig) SimpleTokenAddress() common.Address

func (*ChainConfig) Size

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

func (*ChainConfig) String

func (m *ChainConfig) String() string

func (*ChainConfig) Unmarshal

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

func (*ChainConfig) XXX_DiscardUnknown

func (m *ChainConfig) XXX_DiscardUnknown()

func (*ChainConfig) XXX_Marshal

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

func (*ChainConfig) XXX_Merge

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

func (*ChainConfig) XXX_Size

func (m *ChainConfig) XXX_Size() int

func (*ChainConfig) XXX_Unmarshal

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

type Client

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

func NewHarmonyClient

func NewHarmonyClient(endpoint string) *Client

func (*Client) BlockNumber

func (c *Client) BlockNumber(ctx context.Context) (uint64, error)

BlockNumber returns the most recent block number

func (*Client) EpochLastBlockNumber

func (c *Client) EpochLastBlockNumber(ctx context.Context, epoch uint64) (uint64, error)

EpochLastBlockNumber returns the last block number of the given epoch. Note that it also returns the block number for a future epoch.

func (*Client) FullHeader

func (c *Client) FullHeader(ctx context.Context, height uint64) (*v2.BlockHeader, error)

FullHeader returns the harmony full header for the given height. The complete header can be used to calculate the hash value.

func (Client) GetETHProof

func (cl Client) GetETHProof(address common.Address, storageKeys [][]byte, blockNumber *big.Int) (*ETHProof, error)

type ETHProof

type ETHProof struct {
	AccountProofRLP []byte
	StorageProofRLP [][]byte
}

type PacketAcknowledgement

type PacketAcknowledgement struct {
	Sequence uint64
	Data     []byte
}

type Prover

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

func NewProver

func NewProver(chain *Chain, config ProverConfig) (*Prover, error)

func (*Prover) CreateMsgCreateClient

func (pr *Prover) CreateMsgCreateClient(clientID string, dstHeader core.HeaderI, signer sdk.AccAddress) (*clienttypes.MsgCreateClient, error)

CreateMsgCreateClient creates a CreateClientMsg to this chain

func (*Prover) GetChainID

func (pr *Prover) GetChainID() string

GetChainID returns the chain ID

func (*Prover) GetLatestLightHeight

func (pr *Prover) GetLatestLightHeight() (int64, error)

GetLatestLightHeight returns the latest height on the light client

func (*Prover) QueryChannelWithProof

func (pr *Prover) QueryChannelWithProof(height int64) (chanRes *chantypes.QueryChannelResponse, err error)

QueryChannelWithProof returns the Channel and its proof

func (*Prover) QueryClientConsensusStateWithProof

func (pr *Prover) QueryClientConsensusStateWithProof(height int64, dstClientConsHeight ibcexported.Height) (*clienttypes.QueryConsensusStateResponse, error)

QueryClientConsensusState returns the ClientConsensusState and its proof

func (*Prover) QueryClientStateWithProof

func (pr *Prover) QueryClientStateWithProof(height int64) (*clienttypes.QueryClientStateResponse, error)

QueryClientStateWithProof returns the ClientState and its proof

func (*Prover) QueryConnectionWithProof

func (pr *Prover) QueryConnectionWithProof(height int64) (*conntypes.QueryConnectionResponse, error)

QueryConnectionWithProof returns the Connection and its proof

func (*Prover) QueryLatestHeader

func (pr *Prover) QueryLatestHeader() (out core.HeaderI, err error)

QueryLatestHeader returns the latest header from the chain

func (*Prover) QueryPacketAcknowledgementCommitmentWithProof

func (pr *Prover) QueryPacketAcknowledgementCommitmentWithProof(height int64, seq uint64) (ackRes *chantypes.QueryPacketAcknowledgementResponse, err error)

QueryPacketAcknowledgementCommitmentWithProof returns the packet acknowledgement commitment and its proof

func (*Prover) QueryPacketCommitmentWithProof

func (pr *Prover) QueryPacketCommitmentWithProof(height int64, seq uint64) (comRes *chantypes.QueryPacketCommitmentResponse, err error)

QueryPacketCommitmentWithProof returns the packet commitment and its proof

func (*Prover) SetupHeader

func (pr *Prover) SetupHeader(dstChain core.LightClientIBCQueryierI, baseSrcHeader core.HeaderI) (core.HeaderI, error)

SetupHeader creates a new header based on a given header

func (*Prover) UpdateLightWithHeader

func (pr *Prover) UpdateLightWithHeader() (header core.HeaderI, provableHeight int64, queryableHeight int64, err error)

UpdateLightWithHeader updates a header on the light client and returns the header and height corresponding to the chain

type ProverConfig

type ProverConfig struct {
	TrustingPeriod string `protobuf:"bytes,1,opt,name=trusting_period,json=trustingPeriod,proto3" json:"trusting_period,omitempty"`
}

func (ProverConfig) Build

func (c ProverConfig) Build(chain core.ChainI) (core.ProverI, error)

func (*ProverConfig) Descriptor

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

func (*ProverConfig) Marshal

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

func (*ProverConfig) MarshalTo

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

func (*ProverConfig) MarshalToSizedBuffer

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

func (*ProverConfig) ProtoMessage

func (*ProverConfig) ProtoMessage()

func (*ProverConfig) Reset

func (m *ProverConfig) Reset()

func (*ProverConfig) Size

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

func (*ProverConfig) String

func (m *ProverConfig) String() string

func (ProverConfig) TrustingPeriodDuration

func (c ProverConfig) TrustingPeriodDuration() (time.Duration, error)

func (*ProverConfig) Unmarshal

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

func (*ProverConfig) XXX_DiscardUnknown

func (m *ProverConfig) XXX_DiscardUnknown()

func (*ProverConfig) XXX_Marshal

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

func (*ProverConfig) XXX_Merge

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

func (*ProverConfig) XXX_Size

func (m *ProverConfig) XXX_Size() int

func (*ProverConfig) XXX_Unmarshal

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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