Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some small fix #5

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d2d1624
Add files via upload
biter777 May 23, 2023
ca13344
Add files via upload
biter777 May 23, 2023
75e02c4
Add files via upload
biter777 May 23, 2023
c48bb5b
Update go.mod
biter777 May 28, 2023
c641bd9
Add files via upload
biter777 May 28, 2023
6e12bec
Add files via upload
biter777 May 28, 2023
f27012f
Add files via upload
biter777 May 28, 2023
0b00f64
Add files via upload
biter777 May 28, 2023
094978d
Add files via upload
biter777 May 28, 2023
05c82fc
Add files via upload
biter777 May 28, 2023
dc1b0c4
Add files via upload
biter777 May 28, 2023
5f2db82
Add files via upload
biter777 May 28, 2023
6f5d8e9
Add files via upload
biter777 May 28, 2023
9e7c460
Add files via upload
biter777 May 28, 2023
13463d1
Add files via upload
biter777 May 28, 2023
01e6928
Add files via upload
biter777 May 28, 2023
b383820
Add files via upload
biter777 May 28, 2023
2b17590
Add files via upload
biter777 May 28, 2023
d6512c9
Update README.md
biter777 May 28, 2023
fcf130c
Update go.mod
biter777 May 28, 2023
3b7ca4d
Update go.sum
biter777 May 28, 2023
2589859
Update go.mod
biter777 May 28, 2023
af73456
Update go.mod
biter777 May 28, 2023
b3b4cb5
Update go.mod
biter777 May 28, 2023
f165e49
Update go.mod
biter777 May 28, 2023
7287795
Update go.mod
biter777 May 28, 2023
789b40d
Update go.mod
biter777 May 28, 2023
45025f5
Update go.mod
biter777 May 28, 2023
fa61951
Update go.mod
biter777 May 28, 2023
a8cc225
Update go.sum
biter777 May 28, 2023
f037502
Update go.sum
biter777 May 28, 2023
12b2342
Update go.mod
biter777 May 28, 2023
3eacbed
Update go.mod
biter777 May 28, 2023
f4bf2bd
Update go.mod
biter777 May 28, 2023
ec6e35c
Update go.mod
biter777 May 28, 2023
877622e
Update go.mod
biter777 May 28, 2023
1cd45dd
Update go.mod
biter777 May 28, 2023
aa802ac
Update go.mod
biter777 May 28, 2023
e8fb104
Update go.mod
biter777 May 28, 2023
edac228
Update go.mod
biter777 May 28, 2023
aa9d8ac
Update go.mod
biter777 May 28, 2023
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
18 changes: 15 additions & 3 deletions keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ var (
OpTypeKey = make(map[operations.OpType][]string)
)

//Keys is used as a keystroke for a specific user.
//Only a few keys can be set.
// Keys is used as a keystroke for a specific user.
// Only a few keys can be set.
type Keys struct {
PKey []string
AKey []string
Expand Down Expand Up @@ -63,7 +63,7 @@ func init() {
OpTypeKey["buy_account"] = []string{"active"}
}

//SigningKeys returns the key from the CurrentKeys
// SigningKeys returns the key from the CurrentKeys
func (client *Client) SigningKeys(trx operations.Operation) ([][]byte, error) {
var keys [][]byte

Expand All @@ -75,6 +75,9 @@ func (client *Client) SigningKeys(trx operations.Operation) ([][]byte, error) {
for _, val := range opKeys {
switch val {
case "regular":
if len(client.CurrentKeys.PKey) < 1 {
return nil, errors.New("Client Regular Key not initialized. Use SetKeys method")
}
for _, keyStr := range client.CurrentKeys.PKey {
privKey, err := wif.Decode(keyStr)
if err != nil {
Expand All @@ -83,6 +86,9 @@ func (client *Client) SigningKeys(trx operations.Operation) ([][]byte, error) {
keys = append(keys, privKey)
}
case "active":
if len(client.CurrentKeys.AKey) < 1 {
return nil, errors.New("Client Active Key not initialized. Use SetKeys method")
}
for _, keyStr := range client.CurrentKeys.AKey {
privKey, err := wif.Decode(keyStr)
if err != nil {
Expand All @@ -91,6 +97,9 @@ func (client *Client) SigningKeys(trx operations.Operation) ([][]byte, error) {
keys = append(keys, privKey)
}
case "master":
if len(client.CurrentKeys.OKey) < 1 {
return nil, errors.New("Client Master Key not initialized. Use SetKeys method")
}
for _, keyStr := range client.CurrentKeys.OKey {
privKey, err := wif.Decode(keyStr)
if err != nil {
Expand All @@ -99,6 +108,9 @@ func (client *Client) SigningKeys(trx operations.Operation) ([][]byte, error) {
keys = append(keys, privKey)
}
case "memo":
if len(client.CurrentKeys.MKey) < 1 {
return nil, errors.New("Client Memo Key not initialized. Use SetKeys method")
}
for _, keyStr := range client.CurrentKeys.MKey {
privKey, err := wif.Decode(keyStr)
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion trx.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package viz

import (
"errors"
"time"

"github.com/VIZ-Blockchain/viz-go-lib/api"
Expand All @@ -9,8 +10,11 @@ import (
"github.com/VIZ-Blockchain/viz-go-lib/types"
)

//SendTrx generates and sends an array of transactions to VIZ.
// SendTrx generates and sends an array of transactions to VIZ.
func (client *Client) SendTrx(username string, strx []operations.Operation) (*types.OperationResponse, error) {
if len(strx) < 1 {
return nil, errors.New("no operations")
}
var bresp types.OperationResponse

// Getting the necessary parameters
Expand Down