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

z0bbb_render_home_expired_client_filetest.gno

2.10 Kb · 65 lines
 1// PKGPATH: gno.land/r/aib/main
 2package main
 3
 4import (
 5	"testing"
 6	"time"
 7
 8	tmtesting "gno.land/p/aib/ibc/lightclient/tendermint/testing"
 9	"gno.land/p/aib/ibc/types"
10
11	"gno.land/r/aib/ibc/apps/transfer"
12	"gno.land/r/aib/ibc/core"
13)
14
15// renderHome with a non-active (Expired) client: confirms the Transfer section
16// still lists the client with its status and trusted height, but omits the
17// "send via" txlink since packets can't be sent through it. The client is
18// created Active, then block time is advanced past the trusting period to
19// expire it.
20func main(cur realm) {
21	var (
22		chainID        = "chain-id-2"
23		clientState    = tmtesting.NewClientState(chainID, types.NewHeight(2, 2))
24		apphash        = tmtesting.Hash("apphash")
25		trustedValset  = tmtesting.GenValset()
26		consensusState = tmtesting.GenConsensusState(time.Now(), apphash, trustedValset.Hash())
27	)
28	clientID := core.CreateClient(cross(cur), clientState, consensusState)
29	core.RegisterCounterparty(cross(cur), clientID, [][]byte{[]byte("iavlStoreKey"), []byte("prefix2")}, "07-tendermint-2")
30
31	// Advance block time past the trusting period to expire the client.
32	ctx := testing.GetContext()
33	ctx.Time = time.Now().Add(clientState.TrustingPeriod)
34	testing.SetContext(ctx)
35
36	println(transfer.Render(""))
37}
38
39// Output:
40// # IBC transfer
41//
42// ICS-20 style transfer state and voucher token queries.
43//
44// ## Transfer
45//
46// Trigger an IBC transfer from your wallet. Pick the client of the destination chain:
47//
48// - `07-tendermint-1` — Expired, trusted height `2/2` ([client details](/r/aib/ibc/core:clients/07-tendermint-1))
49//
50// ## Vouchers (0)
51//
52// No vouchers yet.
53//
54// ## Escrow (0)
55//
56// No escrow yet.
57//
58// ## JSON endpoints
59//
60// - [`denoms`](/r/aib/ibc/apps/transfer:denoms): list known IBC denoms (`?page`, `?limit`)
61// - `denoms/ibc/{hash}`: get metadata for an IBC denom
62// - `total_escrow/{denom}`: get total escrow tracked for a base denom
63// - [`vouchers`](/r/aib/ibc/apps/transfer:vouchers): list voucher tokens (`?page`, `?limit`)
64// - `voucher/ibc/{hash}`: get voucher token metadata
65// - `voucher/ibc/{hash}/balance/{addr}`: get a voucher balance for an address