wapi

package module
v0.0.0-...-c4299fa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2021 License: GPL-3.0-or-later Imports: 5 Imported by: 1

README

W(allet)API

Using this library is as simple as:

package main
import (
	"log"
	"git.mrcyjanek.net/mrcyjanek/wapi"
)
func main() {
	// First login
	wapi.Login("cyjan", "6290a06de1bc34202f861275b29947a9a9b9fbfcae")
	// Prepare request
	var request wapi.CheckBalanceRequest
	request.Currency = "doge"
	request.Data.Address = "DDbWmzwXqbBSHVdJmwMGaNK1pGUBQDMppY"
	// Send it
	response := wapi.CheckBalance(request)
	if response.OK {
		// Get balance
		log.Println(response.Balance)
	} else {
		// Handle error
		log.Println(response.Message)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Login

func Login(username string, APIKey string)

Login - set the credentials

Types

type Auth

type Auth struct {
	APIKey   string
	Username string
}

Auth - store all the details required for wapi to work

var Credentials Auth

Credentials - Store all the data required for wapi to work.

type CheckBalanceRequest

type CheckBalanceRequest struct {
	APIKey   string `json:"apikey"`   // This one is set by function
	Username string `json:"username"` // This one is set by function
	Action   string `json:"action"`   // This one is set by function
	Currency string `json:"currency"`
	Data     struct {
		Address string `json:"address"`
	} `json:"data"`
}

CheckBalanceRequest - pass this to CheckBalance function

type CheckBalanceResponse

type CheckBalanceResponse struct {
	OK       bool    `json:"ok"`
	Balance  float64 `json:"balance"`
	Received float64 `json:"received"`
	// This is empty, unless error
	Code    string `json:"code"`
	Message string `json:"message"`
}

CheckBalanceResponse - This is what you can get back

func CheckBalance

func CheckBalance(req CheckBalanceRequest) CheckBalanceResponse

CheckBalance is used to check balance of one address

type GetNewAddressRequest

type GetNewAddressRequest struct {
	APIKey   string   `json:"apikey"`   // This one is set by function
	Username string   `json:"username"` // This one is set by function
	Action   string   `json:"action"`   // This one is set by function
	Currency string   `json:"currency"`
	Data     struct{} `json:"data"`
}

GetNewAddressRequest - pass this to CheckBalance function

type GetNewAddressResponse

type GetNewAddressResponse struct {
	OK      bool   `json:"ok"`
	Address string `json:"address"`
	// This is empty, unless error
	Code    string `json:"code"`
	Message string `json:"message"`
}

GetNewAddressResponse - This is what you can get back

func GetNewAddress

GetNewAddress is used to generate new deposit address

type SendToAddressRequest

type SendToAddressRequest struct {
	APIKey   string `json:"apikey"`   // This one is set by function
	Username string `json:"username"` // This one is set by function
	Action   string `json:"action"`   // This one is set by function
	Currency string `json:"currency"`
	Data     struct {
		Amount  float64 `json:"amount"`
		Address string  `json:"address"`
	} `json:"data"`
}

SendToAddressRequest - pass this to CheckBalance function

type SendToAddressResponse

type SendToAddressResponse struct {
	OK   bool   `json:"ok"`
	TXID string `json:"txid"`
	// This is empty, unless error
	Code    string `json:"code"`
	Message string `json:"message"`
}

SendToAddressResponse - This is what you can get back

func SendToAddress

SendToAddress is used to send money to some address

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL