diff --git a/api/api.go b/api/api.go index 70f72814d..f2b38f670 100644 --- a/api/api.go +++ b/api/api.go @@ -105,6 +105,7 @@ type FullNode interface { StateMinerProvingSet(context.Context, address.Address) ([]*SectorInfo, error) StateMinerPower(context.Context, address.Address, *types.TipSet) (MinerPower, error) StateMinerWorker(context.Context, address.Address, *types.TipSet) (address.Address, error) + StateMinerPeerID(ctx context.Context, m address.Address, ts *types.TipSet) (peer.ID, error) // if tipset is nil, we'll use heaviest StateCall(context.Context, *types.Message, *types.TipSet) (*types.MessageReceipt, error) StateGetActor(ctx context.Context, actor address.Address, ts *types.TipSet) (*types.Actor, error) diff --git a/api/struct.go b/api/struct.go index 005c70965..553586dc5 100644 --- a/api/struct.go +++ b/api/struct.go @@ -79,6 +79,7 @@ type FullNodeStruct struct { StateMinerProvingSet func(context.Context, address.Address) ([]*SectorInfo, error) `perm:"read"` StateMinerPower func(context.Context, address.Address, *types.TipSet) (MinerPower, error) `perm:"read"` StateMinerWorker func(context.Context, address.Address, *types.TipSet) (address.Address, error) `perm:"read"` + StateMinerPeerID func(ctx context.Context, m address.Address, ts *types.TipSet) (peer.ID, error)`perm:"read"` StateCall func(context.Context, *types.Message, *types.TipSet) (*types.MessageReceipt, error) `perm:"read"` StateGetActor func(context.Context, address.Address, *types.TipSet) (*types.Actor, error) `perm:"read"` StateReadState func(context.Context, *types.Actor, *types.TipSet) (*ActorState, error) `perm:"read"` @@ -293,6 +294,10 @@ func (c *FullNodeStruct) StateMinerWorker(ctx context.Context, m address.Address return c.Internal.StateMinerWorker(ctx, m, ts) } +func (c *FullNodeStruct) StateMinerPeerID(ctx context.Context, m address.Address, ts *types.TipSet) (peer.ID, error) { + return c.Internal.StateMinerPeerID(ctx, m, ts) +} + func (c *FullNodeStruct) StateCall(ctx context.Context, msg *types.Message, ts *types.TipSet) (*types.MessageReceipt, error) { return c.Internal.StateCall(ctx, msg, ts) } diff --git a/lotuspond/front/src/Client.js b/lotuspond/front/src/Client.js index 1bfe1981c..698badada 100644 --- a/lotuspond/front/src/Client.js +++ b/lotuspond/front/src/Client.js @@ -49,6 +49,23 @@ class Client extends React.Component { console.log("deal cid: ", dealcid) } + retrieve = (deal) => async () => { + console.log(deal) + let client = await this.props.client.call('Filecoin.WalletDefaultAddress', []) + + let order = { + Root: deal.PieceRef, + Size: deal.Size, + // TODO: support offset + Total: "900", + + Client: client, + Miner: deal.Miner + } + + await this.props.client.call('Filecoin.ClientRetrieve', [order, '/dev/null']) + } + render() { let ppb = Math.round(this.state.total / this.state.blocks * 100) / 100 let ppmbb = Math.round(ppb / (this.state.kbs / 1000) * 100) / 100 @@ -67,6 +84,7 @@ class Client extends React.Component { let deals = this.state.deals.map((deal, i) =>