package core import ( "gno.land/p/aib/ibc/app" "gno.land/p/aib/ibc/host" "gno.land/p/nt/ufmt/v0" ) // RegisterApp registers an IBCApp, the portID is determined using the package // path of the caller, hence it must an other realm. func RegisterApp(cur realm, portID string, app app.IBCApp) { caller := cur.Previous() if caller.IsUser() { panic("RegisterApp can only be called from an other realm") } if err := host.PortIdentifierValidator(portID); err != nil { panic(ufmt.Errorf("invalid portID: %v", err)) } if _, ok := store.routes[portID]; ok { panic(ufmt.Errorf("portID %s has already been registered", portID)) } store.routes[portID] = ibcApp{ IBCApp: app, pkgPath: caller.PkgPath(), address: caller.Address(), } }