-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_util.go
56 lines (52 loc) · 1.64 KB
/
client_util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package bbrpc
// Decodetransaction https://github.com/bigbangcore/BigBang/wiki/JSON-RPC#decodetransaction
func (c *Client) Decodetransaction(txdata string) (*NoneSerializedTransaction, error) {
resp, err := c.sendCmd("decodetransaction", struct {
Txdata string `json:"txdata"`
}{Txdata: txdata})
if err != nil {
return nil, err
}
var ret NoneSerializedTransaction
err = futureParse(resp, &ret)
return &ret, err
}
// Getpubkeyaddress https://github.com/bigbangcore/BigBang/wiki/JSON-RPC#getpubkeyaddress
func (c *Client) Getpubkeyaddress(pubkey string, reversal *string) (*string, error) {
resp, err := c.sendCmd("getpubkeyaddress", struct {
Pubkey string `json:"pubkey,omitempty"`
Reversal *string `json:"reversal,omitempty"`
}{Pubkey: pubkey, Reversal: reversal})
if err != nil {
return nil, err
}
var data string
err = futureParse(resp, &data)
return &data, err
}
// Listunspent https://github.com/bigbangcore/BigBang/wiki/JSON-RPC#listunspent
func (c *Client) Listunspent(address string, fork *string, max uint) (*UnspentTotal, error) {
resp, err := c.sendCmd("listunspent", struct {
Address string `json:"address"`
Fork *string `json:"fork,omitempty"`
Max uint `json:"max"`
}{
Address: address, Fork: fork, Max: max,
})
if err != nil {
return nil, err
}
var data UnspentTotal
err = futureParse(resp, &data)
return &data, err
}
// Makekeypair https://github.com/bigbangcore/BigBang/wiki/JSON-RPC#makekeypair
func (c *Client) Makekeypair() (*Keypair, error) {
resp, err := c.sendCmd("makekeypair", nil)
if err != nil {
return nil, err
}
var data Keypair
err = futureParse(resp, &data)
return &data, err
}