Merge pull request #6075 from filecoin-project/feat/gateway-walletbalance

implement WalletBalance on gateway
This commit is contained in:
Łukasz Magiera 2021-04-23 16:00:54 +02:00 committed by GitHub
commit 86d4f5f738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 0 deletions

View File

@ -43,4 +43,5 @@ type Gateway interface {
StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*MsgLookup, error)
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*MsgLookup, error)
WalletBalance(context.Context, address.Address) (types.BigInt, error)
}

View File

@ -516,6 +516,8 @@ type GatewayStruct struct {
StateVerifiedClientStatus func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*abi.StoragePower, error) ``
StateWaitMsg func(p0 context.Context, p1 cid.Cid, p2 uint64, p3 abi.ChainEpoch, p4 bool) (*MsgLookup, error) ``
WalletBalance func(p0 context.Context, p1 address.Address) (types.BigInt, error) ``
}
}
@ -2601,6 +2603,14 @@ func (s *GatewayStub) StateWaitMsg(p0 context.Context, p1 cid.Cid, p2 uint64, p3
return nil, xerrors.New("method not supported")
}
func (s *GatewayStruct) WalletBalance(p0 context.Context, p1 address.Address) (types.BigInt, error) {
return s.Internal.WalletBalance(p0, p1)
}
func (s *GatewayStub) WalletBalance(p0 context.Context, p1 address.Address) (types.BigInt, error) {
return *new(types.BigInt), xerrors.New("method not supported")
}
func (s *SignableStruct) Sign(p0 context.Context, p1 SignFunc) error {
return s.Internal.Sign(p0, p1)
}

View File

@ -45,6 +45,7 @@ type Gateway interface {
StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error)
StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
StateWaitMsg(ctx context.Context, msg cid.Cid, confidence uint64) (*api.MsgLookup, error)
WalletBalance(context.Context, address.Address) (types.BigInt, error)
}
var _ Gateway = *new(FullNode)

View File

@ -442,6 +442,8 @@ type GatewayStruct struct {
StateVerifiedClientStatus func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*abi.StoragePower, error) ``
StateWaitMsg func(p0 context.Context, p1 cid.Cid, p2 uint64) (*api.MsgLookup, error) ``
WalletBalance func(p0 context.Context, p1 address.Address) (types.BigInt, error) ``
}
}
@ -2064,5 +2066,13 @@ func (s *GatewayStub) StateWaitMsg(p0 context.Context, p1 cid.Cid, p2 uint64) (*
return nil, xerrors.New("method not supported")
}
func (s *GatewayStruct) WalletBalance(p0 context.Context, p1 address.Address) (types.BigInt, error) {
return s.Internal.WalletBalance(p0, p1)
}
func (s *GatewayStub) WalletBalance(p0 context.Context, p1 address.Address) (types.BigInt, error) {
return *new(types.BigInt), xerrors.New("method not supported")
}
var _ FullNode = new(FullNodeStruct)
var _ Gateway = new(GatewayStruct)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -71,6 +71,7 @@ type gatewayDepsAPI interface {
StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error)
StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
StateVMCirculatingSupplyInternal(context.Context, types.TipSetKey) (api.CirculatingSupply, error)
WalletBalance(context.Context, address.Address) (types.BigInt, error) //perm:read
}
var _ gatewayDepsAPI = *new(api.FullNode) // gateway depends on latest
@ -414,6 +415,10 @@ func (a *GatewayAPI) WalletVerify(ctx context.Context, k address.Address, msg []
return sigs.Verify(sig, k, msg) == nil, nil
}
func (a *GatewayAPI) WalletBalance(ctx context.Context, k address.Address) (types.BigInt, error) {
return a.api.WalletBalance(ctx, k)
}
var _ api.Gateway = (*GatewayAPI)(nil)
var _ full.ChainModuleAPI = (*GatewayAPI)(nil)
var _ full.GasModuleAPI = (*GatewayAPI)(nil)