Giter Club home page Giter Club logo

unmarshal-go-sdk's Introduction

unmarshal-go-sdk

A Golang SDK to simplify access to Unmarshal APIs

This project is currently in BETA

Usage Guide

The first step involved is to go get this project.

go get github.com/eucrypt/unmarshal-go-sdk

Create an SDK type and pass it your auth key. (To generate an Auth key you will need to create a user account at Unmarshal Console)

package main

import (
	unmarshal "github.com/eucrypt/unmarshal-go-sdk/pkg"
	conf "github.com/eucrypt/unmarshal-go-sdk/pkg/config"
	"github.com/eucrypt/unmarshal-go-sdk/pkg/constants"
)

func main() {
	sdk := unmarshal.NewWithConfig(conf.Config{
		AuthKey:     "<auth key>",
		Environment: constants.Prod,
	})
}

There are other options to use your own http client if you prefer as well. The SDK is all you now need to query the unmarshal APIs

//For example to get the current Price of Marsh, you can now:
package main

import (
	unmarshal "github.com/eucrypt/unmarshal-go-sdk/pkg"
	conf "github.com/eucrypt/unmarshal-go-sdk/pkg/config"
	"github.com/eucrypt/unmarshal-go-sdk/pkg/constants"
)

func main() {
	sdk := unmarshal.NewWithConfig(conf.Config{
		AuthKey:     "<auth key>",
		Environment: constants.Prod,
	})

	resp, err := sdk.GetTokenPriceBySymbol("marsh")
}

Some functions are chain specific and the chain can be passed in via the constants.Chain package

package main

import (
	unmarshal "github.com/eucrypt/unmarshal-go-sdk/pkg"
	conf "github.com/eucrypt/unmarshal-go-sdk/pkg/config"
	"github.com/eucrypt/unmarshal-go-sdk/pkg/constants"
)

func main() {
	sdk := unmarshal.NewWithConfig(conf.Config{
		AuthKey:     "<auth key>",
		Environment: constants.Prod,
	})

	resp, err := sdk.GetTokenCurrentPrice(constants.BSC, "0x2fa5daf6fe0708fbd63b1a7d1592577284f52256")
}

The SDK has support for the following unmarshal API:

Price Store (Docs)

  • Get Price
    • v1/pricestore/chain/:chain/:address (GetTokenCurrentPrice)
  • Get Price at Instant
    • v1/pricestore/chain/:chain/:address?timestamp= (GetTokenPriceAtInstant)
  • Get Price With Symbol
    • v1/pricestore/:symbol (GetTokenPriceBySymbol)
  • Get Gainers
    • v1/pricestore/chain/:chain/gainers (GetTopGainers)
  • Get Losers
    • v1/pricestore/chain/:chain/losers (GetTopLosers)
  • Get LpTokens
    • v1/pricestore/chain/:chain/lptokens (GetLPTokens)
  • Get Price of List of tokens
    • v1/tokenstore/token/all (GetMultipleTokenPrice)

Token Details (Docs)

  • Get Token With Contract
    • v1/tokenstore/token/address/:address (GetTokenDetailsByContract)
  • Get Token With Symbol
    • v1/tokenstore/token/symbol/:symbol (GetTokenDetailsBySymbol)
  • Get Paginated List Of Tokens
    • v1/tokenstore/token/all (GetTokenList)

Assets API (Docs)

  • Get List of Assets
    • v1/:chain/address/:address/assets (GetTokenAssets)
  • Get Profit and loss
    • v2/:chain/address/:address/userData?contract= (GetProfitAndLoss)

NFT APIs (Docs)

  • Get NFT assets for an address
    • v1/:chain/address/:address/nft-assets (GetNFTAssetsByAddress)
  • Get NFT Transactions by Address
    • v1/:chain/address/:address/nft-transactions (GetNFTTransactionsByAddress)
  • Get NFT Metadata
    • v1/:chain/address/:address/details?tokenId= (GetNFTDetailsByID)
  • Get NFT Holders using the NFT's Token ID
    • v1/:chain/address/:address/nftholders?tokenId= (GetNFTHolderByID)

Transaction APIs (Docs)

  • Get Transaction data for an address
    • v1/:chain/address/:address/transactions?contract=&page=&pageSize= (GetTokenTxns)
  • Get Transactions data for an address V2/Get Transactions with Price data
    • v2/:chain/address/:address/transactions?contract=&page=&pageSize= (GetTokenTxnsV2)
  • Get Transaction details by Transaction ID
    • v1/:chain/transactions/:txID (GetTxnDetails)

Protocol APIs (Docs)

  • Get Protocol Positions for an address
    • v2/protocols/:protocol/address/:address/positions (GetPositions)
  • Get Protocol Pairs
    • v2/protocols/:protocol/pairs (GetPairs)

Api and Supported Chains

API Name Ethereum BSC Matic Avalanche Solana XDC Zilliqa Huobi Arbitrum Celo Fantom Klaytn Fuse Cronos Velas Moonbeam Metis Aurora Matic Supernet zkEVM Mantle Testnet Mantle Mode Manta
GetTokenAssets
GetProfitAndLoss
GetTokenTxns
GetTxnDetails
GetTxnDetailsV2
GetNFTAssets
GetTxns - NFT
GetDetailsByID
GetHoldersByID
GetPriceWithAddress
GetTokensPrice
GetLpTokenPrice
GetLosers
GetGainers

Additionally, support for raw transaction details include:

GetRawTransactionsForAddress : Ethereum: Mainnet, Ethereum: Rinkeby, BSC, BSC: Testnet, Polygon, Polygon: Mumbai, Avalanche: Mainnet, Arbitrum: Mainnet, Celo: Mainnet, Fantom: Mainnet, Klaytn: Mainnet, Fuse: Mainnet, Cronos: Mainnet, Velas: Mainnet, Moonbeam: Mainnet, Metis: Mainnet, Aurora: Mainnet, zkEVM: Mainnet,Mantle: Testnet, Mantle: Mainnet, Mode: Mainnet, Mode: Testnet, Manta: Mainnet, Manta: Testnet

GetBulkTxnDetails : Ethereum: Mainnet, Ethereum: Rinkeby, BSC, BSC: Testnet, Polygon, Polygon: Mumbai, Avalanche: Mainnet, Arbitrum: Mainnet, Celo: Mainnet, Fantom: Mainnet, Klaytn: Mainnet, Fuse: Mainnet, Cronos: Mainnet, Velas: Mainnet, zkEVM: Mainnet, Mantle: Testnet, Mantle: Mainnet, Mode: Mainnet, Mode: Testnet, Manta: Mainnet, Manta: Testnet

This API includes more details and abstains from including price at the time of the transaction

unmarshal-go-sdk's People

Contributors

anusha-unmarshal avatar arhamj avatar chetankashetti avatar jawad-unmarshal avatar pujith-m avatar suyog-bhat avatar

Stargazers

 avatar

Watchers

 avatar

unmarshal-go-sdk's Issues

Mock Objects

Removed dependency on auth keys for testing and refactor tests to work with mock objects matching their returns

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.