Skip to content

Sagleft/utopialib-go

Repository files navigation

logo

Utopia Ecosystem API wrapper written in Golang

Docs

GoDoc go-report Build Status

WARN! utopiago v1 deprecated, use v2 instead

Install

go get github.com/Sagleft/utopialib-go/v2

then

import (
	utopiago "github.com/Sagleft/utopialib-go/v2"
)

Usage example

package main

import (
	"fmt"
	"log"

	utopiago "github.com/Sagleft/utopialib-go/v2"
)

func main() {
	client := utopiago.NewUtopiaClient(utopiago.Config{
		Protocol: "http",
		Port:     22000,
		WsPort:   25000,
	})

	// print own contact data
	contactData, err := client.GetOwnContact()
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println(contactData)

	// print sync progress
	syncProgress, err := client.GetSyncProgress()
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println("sync status:", syncProgress, "%")
}

How can this be used?

  • creating a web service that processes client requests;
  • creation of a payment service;
  • development of a bot for the channel;
  • utility for working with uNS;
  • experiments to explore web3.0;

Projects that use this library

Full list: https://github.com/Sagleft/utopialib-go/network/dependents

Other projects can be found here: https://udocs.gitbook.io/utopia-api/utopia-api/examples-of-projects

generate mocks

just run:

make generate-mocks

udocs