fix program entry
This commit is contained in:
parent
a5195991ae
commit
ea1c459f64
|
@ -18,6 +18,9 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/dfuse-io/solana-go/text"
|
||||
|
||||
"github.com/dfuse-io/solana-go"
|
||||
|
||||
|
@ -43,7 +46,6 @@ var getProgramAccountsCmd = &cobra.Command{
|
|||
|
||||
for _, keyedAcct := range resp {
|
||||
acct := keyedAcct.Account
|
||||
//fmt.Println("Data len:", len(acct.Data), keyedAcct.Pubkey)
|
||||
|
||||
obj, err := decode(acct.Owner, acct.Data)
|
||||
if err != nil {
|
||||
|
@ -56,6 +58,11 @@ var getProgramAccountsCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
fmt.Printf("Data %T: %s\n", obj, string(cnt))
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := text.NewEncoder(os.Stdout).Encode(acct, nil); err != nil {
|
||||
return fmt.Errorf("unable to text encode account: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,9 +33,13 @@ var tokenListMintsCmd = &cobra.Command{
|
|||
if err != nil {
|
||||
return fmt.Errorf("unable to retrieve mints: %w", err)
|
||||
}
|
||||
out := []string{"Supply | Decimals | Token Authority | Freeze Authority"}
|
||||
out := []string{"Mint | Decimals | Supply | Token Authority | Freeze Authority"}
|
||||
for _, m := range mints {
|
||||
line := []string{fmt.Sprintf("%d", m.Supply), fmt.Sprintf("%d", m.Decimals)}
|
||||
line := []string{
|
||||
fmt.Sprintf("%d", m),
|
||||
fmt.Sprintf("%d", m.Supply),
|
||||
fmt.Sprintf("%d", m.Decimals),
|
||||
}
|
||||
if m.MintAuthorityOption != 0 {
|
||||
line = append(line, fmt.Sprintf("%s", m.MintAuthority))
|
||||
} else {
|
||||
|
|
|
@ -31,7 +31,7 @@ import (
|
|||
var tokenRegistryRegisterCmd = &cobra.Command{
|
||||
Use: "register {token-address} {name} {symbol} {logo} {website}",
|
||||
Short: "register meta data for a token",
|
||||
Args: cobra.ExactArgs(4),
|
||||
Args: cobra.ExactArgs(5),
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
vault := mustGetWallet()
|
||||
client := getClient()
|
||||
|
@ -46,15 +46,18 @@ var tokenRegistryRegisterCmd = &cobra.Command{
|
|||
var symbol tokenregistry.Symbol
|
||||
var website tokenregistry.Website
|
||||
|
||||
if logo, err = tokenregistry.LogoFromString(args[1]); err != nil {
|
||||
return fmt.Errorf("invalid logo %q: %w", args[1], err)
|
||||
if name, err = tokenregistry.NameFromString(args[1]); err != nil {
|
||||
return fmt.Errorf("invalid name %q: %w", args[1], err)
|
||||
}
|
||||
if name, err = tokenregistry.NameFromString(args[2]); err != nil {
|
||||
return fmt.Errorf("invalid name %q: %w", args[2], err)
|
||||
|
||||
if symbol, err = tokenregistry.SymbolFromString(args[2]); err != nil {
|
||||
return fmt.Errorf("invalid symbol %q: %w", args[2], err)
|
||||
}
|
||||
if symbol, err = tokenregistry.SymbolFromString(args[3]); err != nil {
|
||||
return fmt.Errorf("invalid symbol %q: %w", args[3], err)
|
||||
|
||||
if logo, err = tokenregistry.LogoFromString(args[3]); err != nil {
|
||||
return fmt.Errorf("invalid logo %q: %w", args[3], err)
|
||||
}
|
||||
|
||||
if website, err = tokenregistry.WebsiteFromString(args[4]); err != nil {
|
||||
return fmt.Errorf("invalid website %q: %w", args[4], err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue