migrate wallet access
This commit is contained in:
parent
4cd92d8576
commit
53384e83d7
@ -36,16 +36,13 @@ func (a *WalletAPI) WalletList(ctx context.Context) ([]address.Address, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *WalletAPI) WalletBalance(ctx context.Context, addr address.Address) (types.BigInt, error) {
|
func (a *WalletAPI) WalletBalance(ctx context.Context, addr address.Address) (types.BigInt, error) {
|
||||||
var bal types.BigInt
|
act, err := a.StateManager.LoadActorTsk(ctx, addr, types.EmptyTSK)
|
||||||
err := a.StateManager.WithParentStateTsk(types.EmptyTSK, a.StateManager.WithActor(addr, func(act *types.Actor) error {
|
|
||||||
bal = act.Balance
|
|
||||||
return nil
|
|
||||||
}))
|
|
||||||
|
|
||||||
if xerrors.Is(err, types.ErrActorNotFound) {
|
if xerrors.Is(err, types.ErrActorNotFound) {
|
||||||
return big.Zero(), nil
|
return big.Zero(), nil
|
||||||
|
} else if err != nil {
|
||||||
|
return big.Zero(), err
|
||||||
}
|
}
|
||||||
return bal, err
|
return act.Balance, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *WalletAPI) WalletSign(ctx context.Context, k address.Address, msg []byte) (*crypto.Signature, error) {
|
func (a *WalletAPI) WalletSign(ctx context.Context, k address.Address, msg []byte) (*crypto.Signature, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user