-
Notifications
You must be signed in to change notification settings - Fork 7
/
paychannelapi.go
30 lines (24 loc) · 1001 Bytes
/
paychannelapi.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
package main
import (
"context"
"github.com/application-research/autoretrieve/messagepusher"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/wallet"
)
type payChannelApiProvider struct {
api.Gateway
wallet *wallet.LocalWallet
mp *messagepusher.MsgPusher
}
func (a *payChannelApiProvider) MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee *api.MessageSendSpec) (*types.SignedMessage, error) {
return a.mp.MpoolPushMessage(ctx, msg, maxFee)
}
func (a *payChannelApiProvider) WalletHas(ctx context.Context, addr address.Address) (bool, error) {
return a.wallet.WalletHas(ctx, addr)
}
func (a *payChannelApiProvider) WalletSign(ctx context.Context, addr address.Address, data []byte) (*crypto.Signature, error) {
return a.wallet.WalletSign(ctx, addr, data, api.MsgMeta{Type: api.MTUnknown})
}