forked from sero-cash/go-sero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_ssi.go
49 lines (37 loc) · 1.27 KB
/
api_ssi.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
package ethapi
import (
"context"
"github.com/sero-cash/go-sero/zero/wallet/ssi"
"github.com/sero-cash/go-sero/zero/txtool"
"github.com/sero-cash/go-czero-import/c_type"
"github.com/sero-cash/go-sero/common/hexutil"
)
type PublicSSIAPI struct {
b Backend
}
func (s *PublicSSIAPI) SzkCreateKr() (kr txtool.Kr) {
return ssi.SSI_Inst.CreateKr(true)
}
func (s *PublicSSIAPI) CreateKr() (kr txtool.Kr) {
return ssi.SSI_Inst.CreateKr(false)
}
func (s *PublicSSIAPI) GetBlocksInfo(ctx context.Context, start hexutil.Uint64, count hexutil.Uint64) ([]ssi.Block, error) {
return ssi.SSI_Inst.GetBlocksInfo(uint64(start), uint64(count))
}
func (s *PublicSSIAPI) Detail(ctx context.Context, roots []c_type.Uint256, skr *c_type.PKr) (douts []txtool.DOut, e error) {
return ssi.SSI_Inst.Detail(roots, skr)
}
func (s *PublicSSIAPI) GenTx(ctx context.Context, param *ssi.PreTxParam) (hash c_type.Uint256, e error) {
return ssi.SSI_Inst.GenTx(param)
}
func (s *PublicSSIAPI) GetTx(ctx context.Context, txhash c_type.Uint256) (tx *txtool.GTx, e error) {
return ssi.SSI_Inst.GetTx(txhash)
}
func (s *PublicSSIAPI) CommitTx(ctx context.Context, txhash c_type.Uint256) (e error) {
if tx, err := ssi.SSI_Inst.GetTx(txhash); err != nil {
e = err
return
} else {
return s.b.CommitTx(tx)
}
}