Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

register.gno

0.89 Kb · 29 lines
 1package statelensics23mpt
 2
 3import (
 4	"gno.land/p/onbloc/ibc/union/lightclient"
 5	statelensp "gno.land/p/onbloc/ibc/union/lightclient/state_lens/ics23_mpt"
 6	"gno.land/p/onbloc/ibc/union/types"
 7	core "gno.land/r/onbloc/ibc/union/core"
 8)
 9
10const ClientType = types.ClientType(statelensp.ClientType)
11
12// RegisterClient registers the state_lens/ics23_mpt light client implementation with core.
13func RegisterClient(cur realm) {
14	core.RegisterClient(cross(cur), ClientType, newClientImpl)
15}
16
17func newClientImpl(clientStateBytes, consensusStateBytes []byte) (lightclient.Interface, error) {
18	clientState, err := statelensp.DecodeClientState(clientStateBytes)
19	if err != nil {
20		return nil, err
21	}
22
23	consensusState, err := statelensp.DecodeConsensusState(consensusStateBytes)
24	if err != nil {
25		return nil, err
26	}
27
28	return statelensp.NewStateLensIcs23MptLightClient(&clientState, &consensusState, core.GetLightClient)
29}