-
Notifications
You must be signed in to change notification settings - Fork 2
/
transaction_issue_sila.go
56 lines (47 loc) · 1.63 KB
/
transaction_issue_sila.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 sila
import (
"github.com/bpancost/sila/domain"
)
func (client ClientImpl) IssueSila(userHandle string) IssueSila {
return &IssueSilaMsg{
Header: client.generateHeader().setUserHandle(userHandle),
Message: "issue_msg",
}
}
type IssueSilaMsg struct {
Header *Header `json:"header"`
Message string `json:"message"`
Amount int64 `json:"amount"`
AccountName string `json:"account_name"`
Descriptor string `json:"descriptor,omitempty"`
BusinessUuid string `json:"business_uuid,omitempty"`
ProcessingType string `json:"processing_type,omitempty"`
}
func (msg *IssueSilaMsg) SetRef(ref string) IssueSila {
msg.Header.setRef(ref)
return msg
}
// Sets the amount to take from the named linked account and put into the Sila wallet
func (msg *IssueSilaMsg) SetAmountFromAccount(amount int64, accountName string) IssueSila {
msg.Amount = amount
msg.AccountName = accountName
return msg
}
func (msg *IssueSilaMsg) SetDescriptor(descriptor string) IssueSila {
msg.Descriptor = descriptor
return msg
}
func (msg *IssueSilaMsg) SetBusinessUuid(businessUuid string) IssueSila {
msg.BusinessUuid = businessUuid
return msg
}
func (msg *IssueSilaMsg) SetProcessingType(processingType string) IssueSila {
msg.ProcessingType = processingType
return msg
}
// The wallet key passed in is what determines the which wallet receives the Sila coin
func (msg *IssueSilaMsg) Do(userWalletPrivateKey string) (domain.IssueSilaResponse, error) {
var responseBody domain.IssueSilaResponse
err := instance.performCallWithUserAuth("/issue_sila", msg, &responseBody, userWalletPrivateKey)
return responseBody, err
}