-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: lotus-lite - replace wallet StateManager with thin client to ga…
…teway
- Loading branch information
Showing
10 changed files
with
163 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package api | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/filecoin-project/go-address" | ||
"github.com/filecoin-project/lotus/chain/types" | ||
"github.com/ipfs/go-cid" | ||
) | ||
|
||
type GatewayAPI interface { | ||
StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error) | ||
ChainHead(ctx context.Context) (*types.TipSet, error) | ||
ChainGetTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error) | ||
MpoolPush(ctx context.Context, sm *types.SignedMessage) (cid.Cid, error) | ||
StateAccountKey(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package modules | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/filecoin-project/lotus/api" | ||
|
||
"github.com/filecoin-project/go-address" | ||
"github.com/filecoin-project/lotus/chain/stmgr" | ||
"github.com/filecoin-project/lotus/chain/types" | ||
) | ||
|
||
type RPCStateManager struct { | ||
gapi api.GatewayAPI | ||
} | ||
|
||
func NewRPCStateManager(api api.GatewayAPI) *RPCStateManager { | ||
return &RPCStateManager{gapi: api} | ||
} | ||
|
||
func (s *RPCStateManager) LoadActorTsk(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.Actor, error) { | ||
return s.gapi.StateGetActor(ctx, addr, tsk) | ||
} | ||
|
||
func (s *RPCStateManager) ResolveToKeyAddress(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error) { | ||
return s.gapi.StateAccountKey(ctx, addr, ts.Key()) | ||
} | ||
|
||
var _ stmgr.StateManagerAPI = (*RPCStateManager)(nil) |