mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-11-10 18:25:17 +00:00
QOL updates
This commit is contained in:
parent
ec7ea35a2d
commit
7db116589d
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.idea/
|
||||
ceremony-client
|
||||
quil_voucher.hex
|
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
FROM golang:1.18
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
|
||||
# Add an entry to .bash_history so we can just run `make dev` and hit up to test the cli
|
||||
RUN echo 'go run ./... test-voucher.hex' >> ~/.bash_history
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o ceremony-client
|
||||
|
||||
CMD ./ceremony-client
|
13
Makefile
Normal file
13
Makefile
Normal file
@ -0,0 +1,13 @@
|
||||
IMAGE_TAG := quillibrium-ceremony-client
|
||||
|
||||
build-docker:
|
||||
docker build -t $(IMAGE_TAG) .
|
||||
|
||||
bash:
|
||||
docker run --rm -it $(IMAGE_TAG) bash
|
||||
|
||||
participate:
|
||||
docker run --rm -it $(IMAGE_TAG) ./ceremony-client "quill-voucher-$(shell date +'%y.%m.%d-%H:%M:%S')"
|
||||
|
||||
dev:
|
||||
docker run --rm -it -v $(PWD):$(PWD) --workdir $(PWD) $(IMAGE_TAG) bash
|
@ -78,7 +78,8 @@ func JoinLobby() {
|
||||
|
||||
client := http.DefaultClient
|
||||
resp, err := client.Do(req)
|
||||
fmt.Println("connected")
|
||||
|
||||
fmt.Println("Connected to sequencer!")
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
34
main.go
34
main.go
@ -11,13 +11,7 @@ func main() {
|
||||
PrintLogo()
|
||||
PrintVersion()
|
||||
|
||||
fmt.Println("Checking sequencer...")
|
||||
state := GetSequencerState()
|
||||
for state != SEQUENCER_ACCEPTING {
|
||||
fmt.Println("Sequencer currently not accepting new contributions, waiting...")
|
||||
time.Sleep(1 * time.Second)
|
||||
state = GetSequencerState()
|
||||
}
|
||||
WaitForSequencerToBeReady()
|
||||
|
||||
JoinLobby()
|
||||
Bootstrap()
|
||||
@ -26,6 +20,30 @@ func main() {
|
||||
ContributeAndGetVoucher()
|
||||
}
|
||||
|
||||
func WaitForSequencerToBeReady() {
|
||||
spinnerChars := []string{"🌕", "🌖", "🌗", "🌘", "🌑", "🌒", "🌓", "🌔"}
|
||||
spinnerIndex := 0
|
||||
attempts := 0
|
||||
removeLine := "\u001B[A\u001B[2K"
|
||||
state := GetSequencerState()
|
||||
for state != SEQUENCER_ACCEPTING {
|
||||
message := "Sequencer currently not accepting new contributions, waiting..."
|
||||
status := fmt.Sprintf("[Attempt %d - Last Checked: %s]", attempts, time.Now().String())
|
||||
|
||||
fmt.Printf("\r%s", removeLine)
|
||||
fmt.Printf("%s\n", message+spinnerChars[spinnerIndex])
|
||||
fmt.Printf(" |- %s", status)
|
||||
|
||||
spinnerIndex = (spinnerIndex + 1) % len(spinnerChars)
|
||||
attempts += 1
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
state = GetSequencerState()
|
||||
}
|
||||
|
||||
fmt.Println("Sequencer is ready for contributions!")
|
||||
}
|
||||
|
||||
func PrintLogo() {
|
||||
fmt.Println(" %#########")
|
||||
fmt.Println(" #############################")
|
||||
@ -64,4 +82,6 @@ func PrintLogo() {
|
||||
func PrintVersion() {
|
||||
fmt.Println(" ")
|
||||
fmt.Println(" Quilibrium Ceremony Client - CLI - v1.0.1")
|
||||
fmt.Println()
|
||||
fmt.Println()
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
654990bfacd0d2702f318089f73b838c64f79b0369840bdff6e1f6b8c3aa2698585c61a0e35794afb9365a4f5ed9c841a62eb9f35d29aa50486780552dd2293cb865905d120047905b98f55bb96a8e2b1e960807a3a0f5b236b7819799a64f7c0a52f8c754dc5086373bb0ce2702ebfba900
|
Loading…
Reference in New Issue
Block a user