forked from lemonlatte/bitmarkdClient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitmark.go
47 lines (36 loc) · 1.15 KB
/
bitmark.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
// Copyright (c) 2014-2017 Bitmark Inc.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package bitmarkdClient
import (
"encoding/json"
"github.com/bitmark-inc/bitmarkd/transactionrecord"
)
type CreateArguments struct {
Assets []*transactionrecord.AssetData `json:"assets"`
Issues []*transactionrecord.BitmarkIssue `json:"issues"`
}
type ProofArguments struct {
PayId string `json:"payId"`
Nonce string `json:"nonce"`
}
// CreateBitmark includes two part: asset creating and issue creating
func (bc *BitmarkdRPCClient) CreateBitmark(assets []*transactionrecord.AssetData, issues []*transactionrecord.BitmarkIssue) (json.RawMessage, error) {
var reply json.RawMessage
args := CreateArguments{
Assets: assets,
Issues: issues,
}
err := bc.call("Bitmarks.Create", &args, &reply)
return reply, err
}
// CreateIssue performs an issue creating request
func (bc *BitmarkdRPCClient) MakeProof(payId string, nonce string) (json.RawMessage, error) {
var reply json.RawMessage
args := ProofArguments{
PayId: payId,
Nonce: nonce,
}
err := bc.call("Bitmarks.Proof", &args, &reply)
return reply, err
}