diff --git a/api/api_storage.go b/api/api_storage.go index 7bfb6eccd..4379031b0 100644 --- a/api/api_storage.go +++ b/api/api_storage.go @@ -51,7 +51,7 @@ type StorageMiner interface { // WithdrawBalance allows to withdraw balance from miner actor to owner address // Specify amount as "0" to withdraw full balance. This method returns a message CID // and does not wait for message execution - WithdrawBalance(ctx context.Context, amount abi.TokenAmount) (cid.Cid, error) //perm:admin + ActorWithdrawBalance(ctx context.Context, amount abi.TokenAmount) (cid.Cid, error) //perm:admin MiningBase(context.Context) (*types.TipSet, error) //perm:read diff --git a/api/proxy_gen.go b/api/proxy_gen.go index 52c01693d..ec532866f 100644 --- a/api/proxy_gen.go +++ b/api/proxy_gen.go @@ -656,6 +656,8 @@ type StorageMinerStruct struct { ActorSectorSize func(p0 context.Context, p1 address.Address) (abi.SectorSize, error) `perm:"read"` + ActorWithdrawBalance func(p0 context.Context, p1 abi.TokenAmount) (cid.Cid, error) `perm:"admin"` + CheckProvable func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) `perm:"admin"` ComputeDataCid func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (abi.PieceInfo, error) `perm:"admin"` @@ -880,8 +882,6 @@ type StorageMinerStruct struct { StorageTryLock func(p0 context.Context, p1 abi.SectorID, p2 storiface.SectorFileType, p3 storiface.SectorFileType) (bool, error) `perm:"admin"` - WithdrawBalance func(p0 context.Context, p1 abi.TokenAmount) (cid.Cid, error) `perm:"admin"` - WorkerConnect func(p0 context.Context, p1 string) error `perm:"admin"` WorkerJobs func(p0 context.Context) (map[uuid.UUID][]storiface.WorkerJob, error) `perm:"admin"` @@ -3956,6 +3956,17 @@ func (s *StorageMinerStub) ActorSectorSize(p0 context.Context, p1 address.Addres return *new(abi.SectorSize), ErrNotSupported } +func (s *StorageMinerStruct) ActorWithdrawBalance(p0 context.Context, p1 abi.TokenAmount) (cid.Cid, error) { + if s.Internal.ActorWithdrawBalance == nil { + return *new(cid.Cid), ErrNotSupported + } + return s.Internal.ActorWithdrawBalance(p0, p1) +} + +func (s *StorageMinerStub) ActorWithdrawBalance(p0 context.Context, p1 abi.TokenAmount) (cid.Cid, error) { + return *new(cid.Cid), ErrNotSupported +} + func (s *StorageMinerStruct) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) { if s.Internal.CheckProvable == nil { return *new(map[abi.SectorNumber]string), ErrNotSupported @@ -5188,17 +5199,6 @@ func (s *StorageMinerStub) StorageTryLock(p0 context.Context, p1 abi.SectorID, p return false, ErrNotSupported } -func (s *StorageMinerStruct) WithdrawBalance(p0 context.Context, p1 abi.TokenAmount) (cid.Cid, error) { - if s.Internal.WithdrawBalance == nil { - return *new(cid.Cid), ErrNotSupported - } - return s.Internal.WithdrawBalance(p0, p1) -} - -func (s *StorageMinerStub) WithdrawBalance(p0 context.Context, p1 abi.TokenAmount) (cid.Cid, error) { - return *new(cid.Cid), ErrNotSupported -} - func (s *StorageMinerStruct) WorkerConnect(p0 context.Context, p1 string) error { if s.Internal.WorkerConnect == nil { return ErrNotSupported diff --git a/build/openrpc/miner.json.gz b/build/openrpc/miner.json.gz index 3c54c65d1..da5cc51f8 100644 Binary files a/build/openrpc/miner.json.gz and b/build/openrpc/miner.json.gz differ diff --git a/cmd/lotus-miner/actor.go b/cmd/lotus-miner/actor.go index 32fb066b9..3707f3f5b 100644 --- a/cmd/lotus-miner/actor.go +++ b/cmd/lotus-miner/actor.go @@ -243,7 +243,7 @@ var actorWithdrawCmd = &cli.Command{ ctx := lcli.ReqContext(cctx) - res, err := nodeApi.WithdrawBalance(ctx, amount) + res, err := nodeApi.ActorWithdrawBalance(ctx, amount) if err != nil { return err } diff --git a/documentation/en/api-v0-methods-miner.md b/documentation/en/api-v0-methods-miner.md index 73aab2168..e24520b20 100644 --- a/documentation/en/api-v0-methods-miner.md +++ b/documentation/en/api-v0-methods-miner.md @@ -9,6 +9,7 @@ * [ActorAddress](#ActorAddress) * [ActorAddressConfig](#ActorAddressConfig) * [ActorSectorSize](#ActorSectorSize) + * [ActorWithdrawBalance](#ActorWithdrawBalance) * [Auth](#Auth) * [AuthNew](#AuthNew) * [AuthVerify](#AuthVerify) @@ -170,8 +171,6 @@ * [StorageReportHealth](#StorageReportHealth) * [StorageStat](#StorageStat) * [StorageTryLock](#StorageTryLock) -* [Withdraw](#Withdraw) - * [WithdrawBalance](#WithdrawBalance) * [Worker](#Worker) * [WorkerConnect](#WorkerConnect) * [WorkerJobs](#WorkerJobs) @@ -294,6 +293,28 @@ Inputs: Response: `34359738368` +### ActorWithdrawBalance +WithdrawBalance allows to withdraw balance from miner actor to owner address +Specify amount as "0" to withdraw full balance. This method returns a message CID +and does not wait for message execution + + +Perms: admin + +Inputs: +```json +[ + "0" +] +``` + +Response: +```json +{ + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" +} +``` + ## Auth @@ -3664,31 +3685,6 @@ Inputs: Response: `true` -## Withdraw - - -### WithdrawBalance -WithdrawBalance allows to withdraw balance from miner actor to owner address -Specify amount as "0" to withdraw full balance. This method returns a message CID -and does not wait for message execution - - -Perms: admin - -Inputs: -```json -[ - "0" -] -``` - -Response: -```json -{ - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" -} -``` - ## Worker diff --git a/node/impl/storminer.go b/node/impl/storminer.go index f1cd3a62c..74b1dc776 100644 --- a/node/impl/storminer.go +++ b/node/impl/storminer.go @@ -1283,7 +1283,7 @@ func (sm *StorageMinerAPI) RuntimeSubsystems(context.Context) (res api.MinerSubs return sm.EnabledSubsystems, nil } -func (sm *StorageMinerAPI) WithdrawBalance(ctx context.Context, amount abi.TokenAmount) (cid.Cid, error) { +func (sm *StorageMinerAPI) ActorWithdrawBalance(ctx context.Context, amount abi.TokenAmount) (cid.Cid, error) { available, err := sm.Full.StateMinerAvailableBalance(ctx, sm.Miner.Address(), types.EmptyTSK) if err != nil { return cid.Undef, xerrors.Errorf("Error getting miner balance: %w", err)