Merge pull request #1349 from filecoin-project/feat/chain-get-types

add some type info to chain get
This commit is contained in:
Whyrusleeping
2020-03-07 16:10:00 -08:00
committed by GitHub
4 changed files with 57 additions and 9 deletions
+5 -2
View File
@@ -356,7 +356,7 @@ func resolveOnce(bs blockstore.Blockstore) func(ctx context.Context, ds ipld.Nod
}
}
func (a *ChainAPI) ChainGetNode(ctx context.Context, p string) (interface{}, error) {
func (a *ChainAPI) ChainGetNode(ctx context.Context, p string) (*api.IpldObject, error) {
ip, err := path.ParsePath(p)
if err != nil {
return nil, xerrors.Errorf("parsing path: %w", err)
@@ -377,7 +377,10 @@ func (a *ChainAPI) ChainGetNode(ctx context.Context, p string) (interface{}, err
return nil, err
}
return node, nil
return &api.IpldObject{
Cid: node.Cid(),
Obj: node,
}, nil
}
func (a *ChainAPI) ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error) {