web3

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CardanoTestNet = BlochainNet{
		NameNet:     "CardanoTestNet",
		ApiURL:      "https://explorer-api.testnet.dandelion.link",
		ExplorerURL: "https://explorer.cardano-testnet.iohkdev.io/en/transaction?id=%s",
	}

	SolanaDevNet = BlochainNet{
		NameNet:     "SolanaDevNet",
		ApiURL:      "https://api.devnet.solana.com",
		ExplorerURL: "https://explorer.solana.com/tx/%s?cluster=devnet",
	}
)

Functions

This section is empty.

Types

type APICardanoClient

type APICardanoClient interface {
	// InfoByAddress ...
	InfoByAddress(ctx context.Context, address string) (AddrSumary, error)
}

func NewAPICardanoClient

func NewAPICardanoClient(options APIClientOptions) (APICardanoClient, error)

NewAPICardanoClient ...

type APIClientOptions

type APIClientOptions struct {

	// Server url to use
	Server string

	// Max number of routines to use for *All methods
	MaxRoutines int

	RetryWaitMin time.Duration // Minimum time to wait
	RetryWaitMax time.Duration // Maximum time to wait
	RetryMax     int           // Maximum number of retries
}

APIClientOptions ...

type APIError

type APIError struct {
	Response interface{}
}

APIError is used to describe errors from the API.

func (*APIError) Error

func (e *APIError) Error() string

type APISolanaClient

type APISolanaClient interface {
	// LastTxByAddress ...
	LastTxByAddress(ctx context.Context, payload PayloadReqJSONRPC) (LastTxByAddr, error)
	// InfoByTx ...
	InfoByTx(ctx context.Context, payload PayloadReqJSONRPC) (TxInfo, error)
}

func NewAPISolanaClient

func NewAPISolanaClient(options APIClientOptions) (APISolanaClient, error)

NewAPISolanaClient ...

type AddrSumary

type AddrSumary struct {
	Result Right `json:"Right"`
}

type BlochainNet

type BlochainNet struct {
	NameNet     string `json:"name_net,omitempty"`
	ApiURL      string `json:"api_url,omitempty"`
	ExplorerURL string `json:"explorer_url,omitempty"`
}

type CABalance

type CABalance struct {
	GetCoin string `json:"getCoin"`
}

type CAChainTip

type CAChainTip struct {
	CTBlockNo   int64  `json:"ctBlockNo"`
	CTSlotNo    int64  `json:"ctSlotNo"`
	CTBlockHash string `json:"ctBlockHash"`
}

type CATxList

type CATxList struct {
	CtbID         string    `json:"ctbId"`
	CtbTimeIssued int64     `json:"ctbTimeIssued"`
	CtbInputs     []CtbPut  `json:"ctbInputs"`
	CtbOutputs    []CtbPut  `json:"ctbOutputs"`
	CtbInputSum   CABalance `json:"ctbInputSum"`
	CtbOutputSum  CABalance `json:"ctbOutputSum"`
	CtbFees       CABalance `json:"ctbFees"`
}

type CtbPut

type CtbPut struct {
	CtaAddress string    `json:"ctaAddress"`
	CtaAmount  CABalance `json:"ctaAmount"`
	CtaTxHash  string    `json:"ctaTxHash"`
	CtaTxIndex int64     `json:"ctaTxIndex"`
}
type Header struct {
	NumReadonlySignedAccounts   int64 `json:"numReadonlySignedAccounts"`
	NumReadonlyUnsignedAccounts int64 `json:"numReadonlyUnsignedAccounts"`
	NumRequiredSignatures       int64 `json:"numRequiredSignatures"`
}

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

type Instruction

type Instruction struct {
	Accounts       []int64 `json:"accounts"`
	Data           string  `json:"data"`
	ProgramIDIndex int64   `json:"programIdIndex"`
}

type LastTxByAddr

type LastTxByAddr struct {
	Jsonrpc string                 `json:"jsonrpc"`
	Result  []ResultTxByAddressSOL `json:"result"`
	ID      int64                  `json:"id"`
}

type Message

type Message struct {
	AccountKeys     []string      `json:"accountKeys"`
	Header          Header        `json:"header"`
	Instructions    []Instruction `json:"instructions"`
	RecentBlockhash string        `json:"recentBlockhash"`
}

type Meta

type Meta struct {
	Err               interface{}   `json:"err"`
	Fee               int64         `json:"fee"`
	InnerInstructions []interface{} `json:"innerInstructions"`
	LogMessages       []string      `json:"logMessages"`
	PostBalances      []int64       `json:"postBalances"`
	PostTokenBalances []interface{} `json:"postTokenBalances"`
	PreBalances       []int64       `json:"preBalances"`
	PreTokenBalances  []interface{} `json:"preTokenBalances"`
	Rewards           []interface{} `json:"rewards"`
	Status            Status        `json:"status"`
}

type PayloadReqJSONRPC

type PayloadReqJSONRPC struct {
	Jsonrpc string        `json:"jsonrpc"`
	Method  string        `json:"method"`
	Params  []interface{} `json:"params"`
	ID      int64         `json:"id"`
}

func (*PayloadReqJSONRPC) ToReader

func (p *PayloadReqJSONRPC) ToReader() *strings.Reader

type ResultTxByAddressSOL

type ResultTxByAddressSOL struct {
	BlockTime          int64       `json:"blockTime"`
	ConfirmationStatus string      `json:"confirmationStatus"`
	Err                interface{} `json:"err"`
	Memo               interface{} `json:"memo"`
	Signature          string      `json:"signature"`
	Slot               int64       `json:"slot"`
}

func (*ResultTxByAddressSOL) ToJSON

func (r *ResultTxByAddressSOL) ToJSON() string

type ResultTxInfo

type ResultTxInfo struct {
	BlockTime   int64       `json:"blockTime"`
	Meta        Meta        `json:"meta"`
	Slot        int64       `json:"slot"`
	Transaction Transaction `json:"transaction"`
}
type Right struct {
	CAAddress     string     `json:"caAddress"`
	CAType        string     `json:"caType"`
	CAChainTip    CAChainTip `json:"caChainTip"`
	CATxNum       int64      `json:"caTxNum"`
	CABalance     CABalance  `json:"caBalance"`
	CATotalInput  CABalance  `json:"caTotalInput"`
	CATotalOutput CABalance  `json:"caTotalOutput"`
	CATotalFee    CABalance  `json:"caTotalFee"`
	CATxList      []CATxList `json:"caTxList"`
}

func (*Right) ToJSON

func (r *Right) ToJSON() string

type Status

type Status struct {
	Ok interface{} `json:"Ok"`
}

type Transaction

type Transaction struct {
	Message    Message  `json:"message"`
	Signatures []string `json:"signatures"`
}

type TxInfo

type TxInfo struct {
	Jsonrpc string       `json:"jsonrpc"`
	Result  ResultTxInfo `json:"result"`
	ID      int64        `json:"id"`
}

func (*TxInfo) ToJSON

func (r *TxInfo) ToJSON() string

Jump to

Keyboard shortcuts

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