OSDN Git Service

module claim
[bytom/vapor.git] / api / cliam_transact.go
1 package api
2
3 import (
4         "context"
5
6         "github.com/vapor/claim/rpc"
7         claimtx "github.com/vapor/claim/rpc/bytom"
8 )
9
10 func (a *API) claimPeginTx(ctx context.Context, ins rpc.ClaimTxParam) Response {
11
12         c := &claimtx.BytomClaimTx{
13                 ClaimTxParam: ins,
14                 Wallet:       a.wallet,
15                 Chain:        a.chain,
16         }
17         resp, err := c.ClaimPeginTx(ctx)
18
19         if err != nil {
20                 return NewErrorResponse(err)
21         }
22
23         return NewSuccessResponse(resp)
24 }
25
26 func (a *API) claimContractPeginTx(ctx context.Context, ins rpc.ClaimTxParam) Response {
27         c := &claimtx.BytomClaimTx{
28                 ClaimTxParam: ins,
29                 Wallet:       a.wallet,
30                 Chain:        a.chain,
31         }
32         resp, err := c.ClaimContractPeginTx(ctx)
33
34         if err != nil {
35                 return NewErrorResponse(err)
36         }
37
38         return NewSuccessResponse(resp)
39 }