Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
6264f0f
Renaming a project
asuleymanov May 24, 2017
10fe33e
get rid of cgo native lib
asuleymanov May 24, 2017
3a724a3
get rid of cgo native lib
asuleymanov May 24, 2017
704773f
Add file transactions/sign_the_shit.go
asuleymanov May 24, 2017
b0a9e04
Change sign_the_shit
asuleymanov May 26, 2017
df20d80
Change var SteemChain
asuleymanov May 29, 2017
442a77d
Merge branch 'master' of github.com:asuleymanov/golos-go
asuleymanov May 29, 2017
600843a
Change import library to sign_the_shit.go
asuleymanov May 29, 2017
311a3dd
Add get_config Full Version.
asuleymanov May 29, 2017
5d57b73
Add transliteration function.
asuleymanov May 30, 2017
c13121e
Add Full Versin Functions:
asuleymanov May 31, 2017
26c7d57
Add Full Version Function :
asuleymanov May 31, 2017
7a0c52b
Add Full Version Function:
asuleymanov May 31, 2017
9361a86
Add Full Version function:
asuleymanov Jun 1, 2017
8f03972
Add function:
asuleymanov Jun 1, 2017
b523519
Add function:
asuleymanov Jun 1, 2017
257b13b
Fix Bug
asuleymanov Jun 1, 2017
57fb667
Add 62 API command in RAW format
asuleymanov Jun 5, 2017
f1e03de
Add Full version:
asuleymanov Jun 5, 2017
1696ae0
Add Full version:
asuleymanov Jun 5, 2017
c83e1f0
Add ful version:
asuleymanov Jun 5, 2017
7f07055
Add sig comment tx.
asuleymanov Jun 7, 2017
7bdfd44
Add JsonMetadata nj CommentOperation struct
asuleymanov Jun 7, 2017
f3e6604
Add:
asuleymanov Jun 8, 2017
db328cf
Add full version:
asuleymanov Jun 9, 2017
bf4053b
Add Market_history_API
asuleymanov Jun 15, 2017
528a320
Bug Fix
asuleymanov Jun 15, 2017
cb17cb4
Add market.get_order_book
asuleymanov Jun 15, 2017
add2f3b
BUg Fix
asuleymanov Jun 15, 2017
636849c
Add all functions from Market_History_API
asuleymanov Jun 16, 2017
5007a6a
Bug fix
asuleymanov Jun 16, 2017
2286b29
BugFix
asuleymanov Jun 16, 2017
e6269de
Add all function from Follow_API
asuleymanov Jun 16, 2017
cdc3db1
Add all function from Login_API
asuleymanov Jun 16, 2017
71b5a0f
Add ful version function get_blog_authors
asuleymanov Jun 16, 2017
3cf65a8
Patch from Translit
asuleymanov Jun 19, 2017
5da8e82
Added to Follow_API:
asuleymanov Jun 19, 2017
fd8392a
Edit Database_api
asuleymanov Jun 19, 2017
7ace333
rm internal/call/utils.go
asuleymanov Jun 19, 2017
8e83ee9
Edit Database_API
asuleymanov Jun 19, 2017
ebcc475
Delete all Raw function
asuleymanov Jun 26, 2017
0e7f985
Add EncodeTag, EncodeTitle from translit.
asuleymanov Jun 26, 2017
528adb9
Added processing of all operations
asuleymanov Jun 27, 2017
310c27d
Reworking the EncodeTag function
asuleymanov Jun 27, 2017
07e161c
Add bool to transaction.Encoder
asuleymanov Jun 29, 2017
d5fc366
Add MarshalTransaction to AccountWitnessVoteOperation
asuleymanov Jun 29, 2017
dc1b197
Add Client Utils
asuleymanov Jun 30, 2017
8dc533f
Change Operations key.
asuleymanov Jul 11, 2017
5b51ec5
Change Sign function:
asuleymanov Jul 11, 2017
f6d0419
Edit client module
asuleymanov Jul 12, 2017
6fb459a
Edit translit module
asuleymanov Jul 12, 2017
3f3c617
Add function on to Client
asuleymanov Jul 18, 2017
f1a0778
Add functions.go to Client
asuleymanov Jul 18, 2017
bdf07eb
Edit
asuleymanov Jul 19, 2017
cec451c
Edit Database Api Data
asuleymanov Jul 19, 2017
91a8adb
Edit client
asuleymanov Jul 20, 2017
2f8960a
Edit Client
asuleymanov Jul 24, 2017
a16d53f
Edit README
asuleymanov Jul 24, 2017
a4a31d1
Edit example/upvote
asuleymanov Jul 24, 2017
aefae01
Added processing CommentOperation from New Post
asuleymanov Jul 24, 2017
52a9e35
Add processing AccountWitnessVoteOperation
asuleymanov Jul 24, 2017
bae098e
Add EncodeBool
asuleymanov Jul 24, 2017
d6e01f9
Add Follows function (follow,unfollow,ignore,notice,reblog)
asuleymanov Jul 25, 2017
a509b1f
Add EncodeMoney
asuleymanov Jul 25, 2017
3610b82
Add Transfer function
asuleymanov Jul 26, 2017
424950b
Edit Client.
asuleymanov Jul 27, 2017
e01de56
Add function
asuleymanov Jul 28, 2017
2aee4c4
Add function Verify_Follow
asuleymanov Aug 2, 2017
e9d4949
Edit Translit
asuleymanov Aug 17, 2017
fd14ac7
Edit sign
asuleymanov Aug 17, 2017
60090d7
Add Login Function
asuleymanov Aug 23, 2017
86559b5
Edit Func
asuleymanov Aug 23, 2017
7974452
Edit bug
asuleymanov Aug 23, 2017
9f5805e
edit Encode JSON
asuleymanov Aug 24, 2017
8a11b83
Edit bug
asuleymanov Sep 11, 2017
b89aebe
Add StringInt64Map type
asuleymanov Sep 13, 2017
b547a53
Changes like Websocket go-steem/rpc
asuleymanov Sep 19, 2017
4244660
Edit GetOpsInBlock
asuleymanov Sep 19, 2017
0be8864
Fix Bug UTF-8 Special symbols
asuleymanov Sep 28, 2017
0197e17
Add OpType into OperationObject
asuleymanov Oct 2, 2017
ceb5659
Edit Client Function
asuleymanov Oct 5, 2017
839636f
Edit Post* function
asuleymanov Oct 9, 2017
fcc7439
Edit Post* function
asuleymanov Oct 9, 2017
d65712b
Add Verify_Post function in Client
asuleymanov Oct 9, 2017
af0d21e
Edit Verify_Post function
asuleymanov Oct 9, 2017
7791005
Edit Debug Info
asuleymanov Oct 9, 2017
c6e938c
Add Operation:
asuleymanov Oct 11, 2017
f399253
Add Operation:
asuleymanov Oct 11, 2017
23370c5
Add
asuleymanov Oct 13, 2017
cf66b98
Update sign_the_shit.go
asuleymanov Oct 14, 2017
70c73a2
Fix
asuleymanov Oct 16, 2017
89e968e
Merge branch 'master' of https://github.com/asuleymanov/golos-go
asuleymanov Oct 16, 2017
6d189fa
The Login function from the standard API is disabled. Instead, it is …
asuleymanov Oct 16, 2017
103bb0e
Fix
asuleymanov Oct 17, 2017
c34f7bd
Fix parsing reputation for new accounts
chiliec Oct 23, 2017
44690e9
Typo in GetWithdrawRoutes function name
chiliec Oct 23, 2017
ff0745d
Merge pull request #7 from Chiliec/hotfix/typo
asuleymanov Oct 23, 2017
3a3d1a3
Change fix of reputation type to types.Int64
chiliec Oct 24, 2017
469f4d8
Merge pull request #6 from Chiliec/hotfix/reputation_parsing
asuleymanov Oct 24, 2017
9cd378f
Fix
asuleymanov Oct 24, 2017
1e21a7b
Add FeedPublishOperation
asuleymanov Oct 25, 2017
732e047
Return to secp256k1 "github.com/btcsuite/btcd/btcec"
asuleymanov Oct 27, 2017
b15861e
Added Billing symbol selection, depending on the network, in the func…
asuleymanov Nov 1, 2017
fc0b3d7
Edit bug in EncodeTitle
asuleymanov Nov 3, 2017
f7600aa
Bugfix into function Post*
asuleymanov Nov 8, 2017
1c427d7
Rename
asuleymanov Nov 10, 2017
01a1dcf
Fix
asuleymanov Nov 10, 2017
4259c73
Edit
asuleymanov Nov 10, 2017
78f0058
Added by Verify_Voter_Weight
asuleymanov Nov 10, 2017
6b2a6aa
Fix
asuleymanov Nov 16, 2017
dff7446
Edit bug
asuleymanov Nov 24, 2017
8f0df6c
Add Beneficiaries
asuleymanov Nov 24, 2017
57845f7
Edit function Post and Comment
asuleymanov Nov 24, 2017
87e9254
Edit
asuleymanov Dec 7, 2017
44b124a
Edit AccountCreateWithDelegationOperation
asuleymanov Dec 19, 2017
8426bfc
Fix
asuleymanov Jan 15, 2018
e43662e
Fix
asuleymanov Jan 15, 2018
a817391
Rename
asuleymanov Feb 6, 2018
09194db
REsolve Conflict
asuleymanov Feb 6, 2018
6a75865
Add GetVotingPower
asuleymanov Feb 26, 2018
ad9f4ce
Add DelegateVestingShares
asuleymanov Feb 26, 2018
c439c87
Fix
asuleymanov Feb 28, 2018
4f44135
Removed the need to use the library "github.com/tendermint/go-crypto".
asuleymanov Mar 12, 2018
7cd88a2
Merge branch 'master' into master
asuleymanov Mar 16, 2018
4c51374
Update operation_object.go
asuleymanov Mar 16, 2018
10a2431
Add helper function GetAuthorReward
asuleymanov Mar 21, 2018
287ff6c
Merge branch 'master' of https://github.com/asuleymanov/rpc
asuleymanov Mar 21, 2018
5b86b82
fix
asuleymanov Mar 21, 2018
8f56885
Edit GetAuthorReward
asuleymanov Mar 21, 2018
e78255c
Redisagne library
asuleymanov Apr 12, 2018
a944825
Big Fix
asuleymanov Apr 13, 2018
1bf252a
Edit Examples
asuleymanov Apr 13, 2018
e98fd5a
Edit AccountCreateOperation
asuleymanov Apr 13, 2018
949933d
Edit Examples
asuleymanov Apr 13, 2018
bb7fe49
Transferring the tomb package to the project.
asuleymanov Apr 25, 2018
6d3e776
Transferring the tomb package to the project.
asuleymanov Apr 25, 2018
d9cbfb8
Fix
asuleymanov May 3, 2018
1f1a61c
Fix websocket
asuleymanov May 29, 2018
e3c45b8
Update README.md
asuleymanov Sep 5, 2018
bd05d1e
Update client.go
asuleymanov Sep 5, 2018
2d73e6a
Update client_type.go
asuleymanov Sep 5, 2018
c3da14c
Update client_type.go
asuleymanov Sep 5, 2018
0455eb1
Update convert.go
asuleymanov Sep 5, 2018
757755d
Update functions.go
asuleymanov Sep 5, 2018
602f1cf
Update helper.go
asuleymanov Sep 5, 2018
41d4b15
Update ident_wif.go
asuleymanov Sep 5, 2018
8bea7fb
Update keys.go
asuleymanov Sep 5, 2018
a0eca53
Update trx.go
asuleymanov Sep 5, 2018
81d68c2
Update verify.go
asuleymanov Sep 5, 2018
d7ca099
Fix
asuleymanov Sep 10, 2018
6b70f95
Fix
asuleymanov Sep 20, 2018
c9245b6
Fix
asuleymanov Sep 25, 2018
b9f5065
Update api.go
asuleymanov Sep 27, 2018
7d2d32c
Update api.go
asuleymanov Sep 27, 2018
fa2a689
Update api.go
asuleymanov Sep 27, 2018
07f58f3
Update api.go
asuleymanov Sep 27, 2018
5146fd4
Update operation_custom_json.go
asuleymanov Sep 28, 2018
dab6d51
Update data.go
asuleymanov Oct 2, 2018
95515e4
Fix
asuleymanov Oct 3, 2018
7911ca0
Update operation_custom_json.go
asuleymanov Oct 4, 2018
dbb7c6a
Update verify.go
asuleymanov Oct 8, 2018
c498c98
Update transport.go
asuleymanov Oct 11, 2018
0892210
Update api.go
asuleymanov Oct 11, 2018
0bc1f71
Update data.go
asuleymanov Oct 11, 2018
d5121a5
Update string_int64_map.go
asuleymanov Oct 11, 2018
bf75da2
Update encoder.go
asuleymanov Oct 11, 2018
f5aecee
Update encoder.go
asuleymanov Oct 15, 2018
d76ac43
Add rfc6979
asuleymanov Oct 16, 2018
920f41a
Redisagned library
asuleymanov Feb 20, 2019
5cb3e41
Bug Fix
asuleymanov Apr 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions .gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 go-steem
Copyright (c) 2016 steem-go

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
144 changes: 53 additions & 91 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,82 @@
# go-steem/rpc
# asuleymanov/steem-go

[![GoDoc](https://godoc.org/github.com/go-steem/rpc?status.svg)](https://godoc.org/github.com/go-steem/rpc)
[![GoDoc](https://godoc.org/github.com/asuleymanov/steem-go?status.svg)](https://godoc.org/github.com/asuleymanov/steem-go)
[![Go Report Card](https://goreportcard.com/badge/github.com/asuleymanov/steem-go)](https://goreportcard.com/report/github.com/asuleymanov/steem-go)

Golang RPC client library for [Steem](https://steem.io).

## Compatibility

`steemd 0.13.0`
Golang RPC client library for [Steem](https://steemit.com).

## Usage

```go
import "github.com/go-steem/rpc"
import "github.com/asuleymanov/steem-go"
```

This package is still very much in development, so `gopkg.in` is not yet available.

## Installation

This package calls [bitcoin-core/secp256k1](https://github.com/bitcoin-core/secp256k1)
using CGO to implement signed transactions, so you need to install `secp256k1` first.
Then it will be possible to build `go-steem/rpc`.

In case you don't need signed transactions, i.e. you don't need to use
`network_broadcast_api`, it is possible to build the package with `nosigning`
tag to exclude the functionality:

```bash
$ go build -tags nosigning
```

## Example

This is just a code snippet. Please check the `examples` directory
for more complete and ready to use examples.

```go
// Instantiate the WebSocket transport.
t, _ := websocket.NewTransport("ws://localhost:8090")

// Use the transport to create an RPC client.
client, _ := rpc.NewClient(t)
defer client.Close()

// Call "get_config".
config, _ := client.Database.GetConfig()

// Start processing blocks.
lastBlock := 1800000
for {
// Call "get_dynamic_global_properties".
props, _ := client.Database.GetDynamicGlobalProperties()

for props.LastIrreversibleBlockNum-lastBlock > 0 {
// Call "get_block".
block, _ := client.Database.GetBlock(lastBlock)

// Process the transactions.
for _, tx := range block.Transactions {
for _, op := range tx.Operations {
switch body := op.Data().(type) {
// Comment operation.
case *types.CommentOperation:
content, _ := client.Database.GetContent(body.Author, body.Permlink)
fmt.Printf("COMMENT @%v %v\n", content.Author, content.URL)

// Vote operation.
cls,_ := client.NewClient([]string{"ws://localhost:8090"},"steem")
defer cls.Close()

// Get config.
log.Println("---> GetConfig()")
config, err := cls.Database.GetConfig()
if err != nil {
return err
}

// Use the last irreversible block number as the initial last block number.
props, err := cls.Database.GetDynamicGlobalProperties()
if err != nil {
return err
}
lastBlock := props.LastIrreversibleBlockNum

// Keep processing incoming blocks forever.
log.Printf("---> Entering the block processing loop (last block = %v)\n", lastBlock)
for {
// Get current properties.
props, err := cls.Database.GetDynamicGlobalProperties()
if err != nil {
return err
}

// Process new blocks.
for props.LastIrreversibleBlockNum-lastBlock > 0 {
block, err := cls.Database.GetBlock(lastBlock)
if err != nil {
return err
}

// Process the transactions.
for _, tx := range block.Transactions {
for _, operation := range tx.Operations {
switch op := operation.Data().(type) {
case *types.VoteOperation:
fmt.Printf("VOTE @%v @%v/%v\n", body.Voter, body.Author, body.Permlink)
log.Printf("@%v voted for @%v/%v\n", op.Voter, op.Author, op.Permlink)

// You can add more cases, it depends on what
// operations you actually need to process.
// You can add more cases here, it depends on
// what operations you actually need to process.
}
}
}

lastBlock++
}

lastBlock++
// Sleep for STEEMIT_BLOCK_INTERVAL seconds before the next iteration.
time.Sleep(time.Duration(config.BlockInterval) * time.Second)
}

time.Sleep(time.Duration(config.SteemitBlockInterval) * time.Second)
}
```

## Package Organisation

You need to create a `Client` object to be able to do anything. To be able to
instantiate a `Client`, you first need to create a transport to be used to
execute RPC calls. The WebSocket transport is available in `transports/websocket`.
Then you just need to call `NewClient(transport)`.

You need to create a `Client` object to be able to do anything.
Then you just need to call `NewClient()`.

Once you create a `Client` object, you can start calling the methods exported
via `steemd`'s RPC endpoint by invoking associated methods on the client object.
Expand All @@ -99,33 +88,6 @@ For example, to call `get_block` from `database_api`, you need to use
When looking for a method to call, all you need is to turn the method name into
CamelCase, e.g. `get_config` becomes `Client.Database.GetConfig`.

### Raw and Full Methods

There are two methods implemented for every method exported via the RPC endpoint.
The regular version and the raw version. Let's see an example for `get_config`:

```go
func (client *Client) GetConfig() (*Config, error) {
...
}

func (client *Client) GetConfigRaw() (*json.RawMessage, error) {
...
}
```

As we can see, the difference is that the raw version returns `*json.RawMessage`,
so it is not trying to unmarshall the response into a properly typed response.

There are two reasons for this:

1. To be able to see raw data.
2. To be able to call most of the remote methods even though the response
object is not yet known or specified.

It is already benefitial to just have the raw version because at least
the method parameters are statically typed.

## Status

This package is still under rapid development and it is by no means complete.
Expand Down
99 changes: 99 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# API

This package adds support for `steem api`.

## State

| **ID** | **Command Name** | **Version** |
| :-: | :-: | :-: |
| **account_by_key** |
| 1 | get_key_references | **RAW** |
| **account_history** |
| 1 | get_account_history | **DONE** |
| **committee_api** |
| 1 | get_committee_request | **DONE** |
| 2 | get_committee_request_votes | **DONE** |
| 3 | get_committee_requests_list | **DONE** |
| **database_api** |
| 1 | get_account_count | **DONE** |
| 2 | get_accounts | **DONE** |
| 3 | get_block | **DONE** |
| 4 | get_block_header | **DONE** |
| 5 | get_chain_properties | **DONE** |
| 6 | get_config | **DONE** |
| 7 | get_database_info | **DONE** |
| 8 | get_dynamic_global_properties | **DONE** |
| 9 | get_escrow | **DONE** |
| 10 | get_expiring_vesting_delegations | **DONE** |
| 11| get_hardfork_version | **DONE** |
| 12| get_next_scheduled_hardfork | **DONE** |
| 13 | get_owner_history | **DONE** |
| 14 | get_potential_signatures | **DONE** |
| 15 | get_proposed_transaction | **DONE** |
| 16 | get_recovery_request | **DONE** |
| 17 | get_required_signatures | **DONE** |
| 18 | get_transaction_hex | **DONE** |
| 19 | get_vesting_delegations | **DONE** |
| 20 | get_withdraw_routes | **DONE** |
| 21 | lookup_account_names | **DONE** |
| 22 | lookup_accounts | **DONE** |
| 23 | verify_account_authority | **DONE** |
| 24 | verify_authority | **DONE** |
| **follow** |
| 1 | get_blog | **DONE** |
| 2 | get_blog_authors | **DONE** |
| 3 | get_blog_entries | **DONE** |
| 4 | get_feed | **DONE** |
| 5 | get_feed_entries | **DONE** |
| 6 | get_follow_count | **DONE** |
| 7 | get_followers | **DONE** |
| 8 | get_following | **DONE** |
| 9 | get_reblogged_by | **DONE** |
| **invite_api** |
| 1 | get_invites_list | **DONE** |
| 2 | get_invite_by_id | **DONE** |
| 3 | get_invite_by_key | **DONE** |
| **network_broadcast_api** |
| 1 | broadcast_block | **NONE** |
| 2 | broadcast_transaction | **DONE** |
| 3 | broadcast_transaction_synchronous | **DONE** |
| 4 | broadcast_transaction_with_callback | **NONE** |
| **operation_history** |
| 1 | get_ops_in_block | **DONE** |
| 2 | get_transaction | **DONE** |
| **social_network** |
| 1 | get_account_votes | **DONE** |
| 2 | get_active_votes | **DONE** |
| 3 | get_all_content_replies | **DONE** |
| 4 | get_content | **DONE** |
| 5 | get_content_replies | **DONE** |
| 6 | get_replies_by_last_update | **DONE** |
| **tags** |
| 1 | get_discussions_by_active | **DONE** |
| 2 | get_discussions_by_author_before_date | **DONE** |
| 3 | get_discussions_by_blog | **DONE** |
| 4 | get_discussions_by_cashout | **DONE** |
| 5 | get_discussions_by_children | **DONE** |
| 6 | get_discussions_by_contents | **DONE** |
| 7 | get_discussions_by_created | **DONE** |
| 8 | get_discussions_by_feed | **DONE** |
| 9 | get_discussions_by_hot | **DONE** |
| 10 | get_discussions_by_payout | **DONE** |
| 11 | get_discussions_by_trending | **DONE** |
| 12 | get_discussions_by_votes | **DONE** |
| 13 | get_languages | **DONE** |
| 14 | get_tags_used_by_author | **RAW** |
| 15 | get_trending_tags | **DONE** |
| **witness_api** |
| 1 | get_active_witnesses | **DONE** |
| 2 | get_miner_queue | **DONE** |
| 3 | get_witness_by_account | **DONE** |
| 4 | get_witness_count | **DONE** |
| 5 | get_witness_schedule | **DONE** |
| 6 | get_witnesses | **DONE** |
| 7 | get_witnesses_by_vote | **DONE** |
| 8 | lookup_witness_accounts | **DONE** |

## License

MIT, see the `LICENSE` file.
25 changes: 25 additions & 0 deletions api/api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package api

import (
"encoding/json"

"github.com/asuleymanov/steem-go/transports"
)

//API plug-in structure
type API struct {
caller transports.Caller
}

//NewAPI plug-in initialization
func NewAPI(caller transports.Caller) *API {
return &API{caller}
}

func (api *API) call(apiID string, method string, params, resp interface{}) error {
return api.caller.Call("call", []interface{}{apiID, method, params}, resp)
}

func (api *API) setCallback(apiID string, method string, callback func(raw json.RawMessage)) error {
return api.caller.SetCallback(apiID, method, callback)
}
Loading