Terra client in golang with multiple protocol implementation (anchor, astroport, prism, ...)

Terra


A terra client with some protocol partial implementations (anchor, prism, terraswap type routers, ...)

To be able to compile, you need to add the following replace in your go.mod :

replace (
	github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76
	github.com/cosmos/cosmos-sdk => github.com/terra-money/cosmos-sdk v0.44.5-terra.2
	github.com/cosmos/ledger-cosmos-go => github.com/terra-money/ledger-terra-go v0.11.2
	github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
	github.com/tecbot/gorocksdb => github.com/cosmos/gorocksdb v1.2.0
	github.com/tendermint/tendermint => github.com/terra-money/tendermint v0.34.14-terra.2
	google.golang.org/grpc => google.golang.org/grpc v1.33.2
)

Examples


Querying Anchor borrow limit

    ctx := context.Background()
	
    querier := terra.NewQuerier(
		httpClient := &http.Client{
            Timeout: 30 * time.Second,
		}, 
		"https://lcd.terra.dev")
	
    walletAddress, err := cosmos.AccAddressFromBech32("walletAddress")

    anc, err := anchor.NewAnchor(querier)
    if err != nil {
        panic(err)
    }
    borrowLimit, err := anc.Overseer.BorrowLimit(ctx, walletAddress)
    if err != nil {
        panic(err)
    }
	

Depositing UST to Anchor

    ctx := context.Background()
	
    querier := terra.NewQuerier(
		httpClient := &http.Client{
            Timeout: 30 * time.Second,
		}, 
		"https://lcd.terra.dev")
	
    wallet, err := terra.NewWalletFromMnemonic(
        querier,
        "mnemonic",
        0,
        0)
    if err != nil {
        panic(err)
    }

    anc, err := anchor.NewAnchor(querier)
    if err != nil {
        panic(err)
    }
    err = terra.NewTransaction(querier).
        Message(func() (cosmos.Msg, error) {
            return anc.Market.NewDepositUSTMessage(wallet.Address(), decimal.NewFromInt(100))
        }).
        ExecuteAndWaitFor(ctx, wallet)
	
	
Similar Resources

Go Implementation of the Spacemesh protocol full node. 💾⏰💪

Go Implementation of the Spacemesh protocol full node. 💾⏰💪

A Programmable Cryptocurrency go-spacemesh 💾 ⏰ 💪 Thanks for your interest in this open source project. This repo is the go implementation of the Spa

Dec 29, 2022

Security research and open source implementation of the Apple 'Wireless Accessory Configuration' (WAC) protocol

Security research and open source implementation of the Apple 'Wireless Accessory Configuration' (WAC) protocol

Apple 'Wireless Accessory Configuration' (WAC) research Introduction This repository contains some research on how the WAC protocol works. I was mostl

Jul 28, 2022

Official Go implementation of the Ethereum protocol

Go Ethereum Official Golang implementation of the Ethereum protocol. Automated builds are available for stable releases and the unstable master branch

Jan 8, 2023

Dxc - Go implementation of DxChain3.0 protocol

Dxc - Go implementation of DxChain3.0 protocol

DxChain 3.0 The Ecosystem Powered by DxChain 3.0 Smart Contract Platform While c

Nov 10, 2022

This is a close to decentralized RSS3 Network implementation of RSS3 protocol v0.4.0 with full indexing function in Go

This is a close to decentralized RSS3 Network implementation of RSS3 protocol v0.4.0 with full indexing function in Go

This is a close to decentralized RSS3 Network implementation of RSS3 protocol v0.4.0 with full indexing function in Go

Aug 4, 2022

A Commander for Go implementation of official Ethereum Client

Young A Commander for Go implementation of official Ethereum Client by zhong-my. Overview Young Dependencies Young stands on the shoulder of many grea

Oct 14, 2021

StarkNet client implementation.

StarkNet client implementation.

juno Starknet client implementation. Building from source Run the following command. % make all Executables Command Description juno The StarkNet full

Dec 30, 2022

A multiformat-inspired go module for working with multiple kinds of keypairs.

A multiformat-inspired go module for working with multiple kinds of keypairs.

Apr 4, 2022

Avalanche: a network composed of multiple blockchains

Coreth and the C-Chain Avalanche is a network composed of multiple blockchains.

Dec 14, 2022
Get any cryptocurrencies ticker and trade data in real time from multiple exchanges and then save it in multiple storage systems.
Get any cryptocurrencies ticker and trade data in real time from multiple exchanges and then save it in multiple storage systems.

Cryptogalaxy is an app which will get any cryptocurrencies ticker and trade data in real time from multiple exchanges and then saves it in multiple storage systems.

Jan 4, 2023
Eunomia is a distributed application framework that support Gossip protocol, QuorumNWR algorithm, PBFT algorithm, PoW algorithm, and ZAB protocol and so on.

Introduction Eunomia is a distributed application framework that facilitates developers to quickly develop distributed applications and supports distr

Sep 28, 2021
Interblockchain communication protocol (IBC) implementation in Golang.

ibc-go Interblockchain communication protocol (IBC) implementation in Golang built as a SDK module. Components Core The core/ directory contains the S

Jan 7, 2023
Official Golang implementation of the Ethereum protocol

Go Ethereum Official Golang implementation of the Ethereum protocol. Automated builds are available for stable releases and the unstable master branch

Nov 24, 2021
RepoETH - Official Golang implementation of the Ethereum protocol
RepoETH - Official Golang implementation of the Ethereum protocol

HANNAGAN ALEXANDRE Powershell Go Ethereum Official Golang implementation of the

Jan 3, 2022
Go-ethereum - Official Golang implementation of the Ethereum protocol

Go Ethereum Official Golang implementation of the Ethereum protocol. Automated b

Jan 4, 2022
Official Golang implementation of the Ethereum protocol

Go Ethereum Official Golang implementation of the Ethereum protocol. Automated builds are available for stable releases and the unstable master branch

Sep 20, 2022
Koisan-chain - Official Golang implementation of the Koisan protocol

Go Ethereum Official Golang implementation of the Koisan protocol. Building the

Feb 6, 2022
Ethereum go-ethereum - Official Golang implementation of the Ethereum protocol

Go Ethereum Official Golang implementation of the Ethereum protocol. Automated b

Feb 17, 2022
Implementation of the Filecoin protocol, written in Go
Implementation of the Filecoin protocol, written in Go

Project Lotus - 莲 Lotus is an implementation of the Filecoin Distributed Storage Network. For more details about Filecoin, check out the Filecoin Spec

Jan 9, 2023