-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore!: remove redundant mechanisms to submit pfbs
- Loading branch information
1 parent
e608781
commit 6305141
Showing
4 changed files
with
86 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package app | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/celestiaorg/celestia-app/app" | ||
"github.com/celestiaorg/celestia-app/app/encoding" | ||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" | ||
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" | ||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" | ||
"google.golang.org/grpc" | ||
"google.golang.org/grpc/credentials/insecure" | ||
) | ||
|
||
func QueryAccount(addr string) error { | ||
ecfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) | ||
|
||
conn, err := grpc.Dial("consensus.lunaroasis.net:9090", grpc.WithTransportCredentials(insecure.NewCredentials())) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
authQC := authtypes.NewQueryClient(conn) | ||
|
||
authresp, err := authQC.Account(context.Background(), &authtypes.QueryAccountRequest{ | ||
Address: addr, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
var acc authtypes.AccountI | ||
err = ecfg.InterfaceRegistry.UnpackAny(authresp.Account, &acc) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
switch acc := acc.(type) { | ||
case *vestingtypes.PeriodicVestingAccount: | ||
fmt.Println("periodic", acc) | ||
case *vestingtypes.ContinuousVestingAccount: | ||
fmt.Println("continuous", acc) | ||
case *authtypes.BaseAccount: | ||
fmt.Println("base account", acc) | ||
default: | ||
fmt.Println("unknown account type", acc) | ||
} | ||
|
||
bankQC := banktypes.NewQueryClient(conn) | ||
spendableResp, err := bankQC.SpendableBalances(context.Background(), &banktypes.QuerySpendableBalancesRequest{ | ||
Address: addr, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Println(spendableResp.Balances) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters