Categorygithub.com/DefinitelyNotAGoat/go-tezos
modulepackage
1.0.0
Repository: https://github.com/definitelynotagoat/go-tezos.git
Documentation: pkg.go.dev

# README

GoDoc

A Tezos Go Library

Go Tezos is a GoLang driven library for your Tezos node.

Installation

Get goTezos

go get github.com/DefinitelyNotAGoat/go-tezos

Quick Start

Go Tezos is split into multiple services underneath to help organize it's functionality and also makes the library easier to maintain.

To understand how Go Tezos works, take a look at the GoTezos Structure:

type GoTezos struct {
	client    *client
	Constants NetworkConstants
	Block     *BlockService
	SnapShot  *SnapShotService
	Cycle     *CycleService
	Account   *AccountService
	Delegate  *DelegateService
	Network   *NetworkService
	Operation *OperationService
	Contract  *ContractService
}

You can see GoTezos is a wrapper for an http client, and services such as block, SnapShot, Cycle, Account, Delegate, Network, Operation, and Contract. Each service has it's own set of functions. You can see examples of using the Block and SnapShot service below.

Getting A Block

package main

import (
	"fmt"
	goTezos "github.com/DefinitelyNotAGoat/go-tezos"
)

func main() {
	gt, err := NewGoTezos("http://127.0.0.1:8732")
	if err != nil {
		t.Errorf("could not connect to network: %v", err)
	}

	block, err := gt.Block.Get(1000)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(block)
}

Getting a Snap Shot For A Cycle

	snapshot, err := gt.SnapShot.Get(50)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(snapshot)

More Documentation

See github pages

Contributers

Note

Because this project is gaining some traction I made the decision to squash all commits into a single commit, so that we can have a clean and well organized commit history going forward. By doing that, the commit history doesn't reflect the contributions of some very helpful people apart of Tezos community and the go-tezos project. Please take a look at the pull request history to see their individual contributions.

Special Thank You

I want to make sure the following people are recognized and give a special thank you to some of the original contributers to go-tezos:

Pull Requests

Go Tezos is a relatively large project and has the potential to be larger, because of that it's important to maintain quality code and PR's. Please review the pull request guide lines here.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

# Functions

NewGoTezos is a constructor that returns a GoTezos object.

# Constants

MUTEZ is a helper for balance devision.

# Structs

AccountService is a struct wrapper for account functions.
Block is a block returned by the Tezos RPC API.
BlockService is a struct wrapper for all block functions.
Bootstrap is a structure representing the bootstrapped response.
ContentsMetadata is the Metadata found in the Contents in a operation of a block returned by the Tezos RPC API.
ContractService is a struct wrapper for contract functions.
Conts is helper structure to build out the contents of a a transfer operation to post to the Tezos RPC.
CycleService is a struct wrapper for cycle functions.
Delegate is representation of a delegate on the Tezos Network.
DelegateReport represents a rewards report for a delegate and all their delegations for a cycle.
DelegateService is a struct wrapper for delegate related functions.
DelegationReport represents a rewards report for a delegation in DelegateReport.
FrozenBalance is representation of frozen balance on the Tezos network.
FrozenBalanceRewards is a FrozenBalanceRewards query returned by the Tezos RPC API.
GoTezos is the driver of the library, it inludes the several RPC services like Block, SnapSHot, Cycle, Account, Delegate, Operations, Contract, and Network.
NetworkConstants represents the network constants returned by the Tezos network.
NetworkService is wrapper representing network functions.
NetworkVersion represents the network version returned by the Tezos network.
NodeService is a service for node related functions.
OperationService is a struct wrapper for operation related functions.
Payment is a helper struct for transfers.
SnapShot is a SnapShot on the Tezos Network.
SnapShotQuery is a SnapShot returned by the Tezos RPC API.
SnapShotService is a struct wrapper for snap shot functions.
StructBalanceUpdates is the BalanceUpdates found in the Metadata of a block returned by the Tezos RPC API.
StructContents is the Contents found in a operation of a block returned by the Tezos RPC API.
StructHeader is a header in a block returned by the Tezos RPC API.
StructLevel the Level found in the Metadata of a block returned by the Tezos RPC API.
StructMaxOperationListLength is the MaxOperationListLength found in the Metadata of a block returned by the Tezos RPC API.
StructMetadata is the Metadata in a block returned by the Tezos RPC API.
StructOperations is the Operations found in a block returned by the Tezos RPC API.
StructTestChainStatus is the TestChainStatus found in the Metadata of a block returned by the Tezos RPC API.
Transfer a complete transfer request.
Wallet needed for signing operations.

# Type aliases

BakingRights a representation of baking rights on the Tezos network.
Connections represents network connections.
EndorsingRights is a representation of endorsing rights on the Tezos network.
NetworkVersions is an array of NetworkVersion.