Skip to content

Latest commit

 

History

History
executable file
·
41 lines (31 loc) · 1.18 KB

README.md

File metadata and controls

executable file
·
41 lines (31 loc) · 1.18 KB

scorum/scorum-go

Go Report Card GoDoc Build Status

Golang RPC client library for Scorum. Both http and websocket transports are supported. The websocket one allows to set callbacks.

Usage

import "github.com/scorum/scorum-go"

Example

import (
    scorum "github.com/scorum/scorum-go"
    "github.com/scorum/scorum-go/rpc"
)

const testNet = "https://testnet.scorum.com"

// create client
transport := rpc.NewHTTPTransport(testNet)
client := NewClient(transport)

// get last 100 transactions of the particular account
history, _ := client.AccountHistory.GetAccountHistory("acc1", -1, 100)

for seq, trx := range history {
    for _, op := range trx.Operations {
        switch body := op.(type) {
        case *types.TransferOperation:
            // do something with the incoming transaction
        }
    }
}