Search Apps Documentation Source Content File Folder Download Copy Actions Download

z0a_init_filetest.gno

1.04 Kb · 33 lines
 1// PKGPATH: gno.land/r/aib/main
 2package main
 3
 4import (
 5	"time"
 6
 7	tmtesting "gno.land/p/aib/ibc/lightclient/tendermint/testing"
 8	"gno.land/p/aib/ibc/types"
 9
10	// Import to trigger the init and register the app
11	_ "gno.land/r/aib/ibc/apps/transfer"
12	"gno.land/r/aib/ibc/core"
13)
14
15// init: ensure app is registered
16func main(cur realm) {
17	var (
18		chainID        = "chain-id-2"
19		clientState    = tmtesting.NewClientState(chainID, types.NewHeight(2, 2))
20		apphash        = tmtesting.Hash("apphash")
21		trustedValset  = tmtesting.GenValset()
22		consensusState = tmtesting.GenConsensusState(time.Now(), apphash, trustedValset.Hash())
23	)
24	clientID := core.CreateClient(cross(cur), clientState, consensusState)
25	core.RegisterCounterparty(cross(cur), clientID, [][]byte{[]byte("iavlStoreKey"), []byte("prefix2")}, "07-tendermint-2")
26
27	println("----------- assert render apps")
28	println(core.Render("apps"))
29}
30
31// Output:
32// ----------- assert render apps
33// [{"port_id":"transfer","pkg_path":"gno.land/r/aib/ibc/apps/transfer","address":"g1tp3gk4quumurav4858hjfdy6hxtyffwmnxyr00"}]