From 60cca3fcf1ec5cc78f726e6a32d8bae91d9fc123 Mon Sep 17 00:00:00 2001 From: fabtagliaferro Date: Wed, 31 Aug 2022 16:03:43 +0200 Subject: [PATCH] add main program for commercionetwork ignite chain --- commercionetwork_faucet/README.md | 3 ++ .../commercionetworkfaucet.go | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 commercionetwork_faucet/README.md create mode 100644 commercionetwork_faucet/commercionetworkfaucet.go diff --git a/commercionetwork_faucet/README.md b/commercionetwork_faucet/README.md new file mode 100644 index 0000000000..8925874a79 --- /dev/null +++ b/commercionetwork_faucet/README.md @@ -0,0 +1,3 @@ +Execute the faucet with `go run .` while in a terminal in this folder. + +This program has been tested with a `ignite chain serve` local network launched from a `commercionetwork` repo folder. \ No newline at end of file diff --git a/commercionetwork_faucet/commercionetworkfaucet.go b/commercionetwork_faucet/commercionetworkfaucet.go new file mode 100644 index 0000000000..d1e803d2da --- /dev/null +++ b/commercionetwork_faucet/commercionetworkfaucet.go @@ -0,0 +1,36 @@ +package main + +import ( + "context" + "net/http" + + "github.com/ignite/cli/ignite/pkg/cosmosfaucet" + + "github.com/ignite/cli/ignite/pkg/chaincmd" + chaincmdrunner "github.com/ignite/cli/ignite/pkg/chaincmd/runner" +) + +func main() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + cmd := chaincmd.New("commercionetworkd") + + runner, err := chaincmdrunner.New(ctx, cmd) + if err != nil { + panic(err) + } + + comDenom := "ucommercio" + + faucet, err := cosmosfaucet.New(ctx, runner, + cosmosfaucet.Account("bob", "special chest leaf section reunion inflict busy blouse inflict kid alcohol hazard embody mosquito green turkey street very lab forest gain disease hollow bomb", "com"), + cosmosfaucet.Coin(1000, 2000, comDenom), + cosmosfaucet.ChainID("commercionetwork"), + ) + if err != nil { + panic(err) + } + + http.ListenAndServe(":8181", faucet) +}