diff --git a/cmd/slnc/cmd/token_registry_list.go b/cmd/slnc/cmd/token_registry_list.go index 5c1a912..cdd050b 100644 --- a/cmd/slnc/cmd/token_registry_list.go +++ b/cmd/slnc/cmd/token_registry_list.go @@ -37,7 +37,7 @@ var tokenRegistryListCmd = &cobra.Command{ return fmt.Errorf("unable to retrieve entries: %w", err) } - out := []string{"Is Initialized | Mint Address | Registration Authority | Logo | Name | Symbol"} + out := []string{"Is Initialized | Mint Address | Registration Authority | Logo | Name | Symbol | Website"} for _, e := range entries { initalized := "false" @@ -52,6 +52,7 @@ var tokenRegistryListCmd = &cobra.Command{ e.Logo.String(), e.Name.String(), e.Symbol.String(), + e.Website.String(), } out = append(out, strings.Join(line, " | ")) } diff --git a/cmd/slnc/cmd/token_registry_register.go b/cmd/slnc/cmd/token_registry_register.go index b41614b..70d9ed4 100644 --- a/cmd/slnc/cmd/token_registry_register.go +++ b/cmd/slnc/cmd/token_registry_register.go @@ -29,7 +29,7 @@ import ( ) var tokenRegistryRegisterCmd = &cobra.Command{ - Use: "register {token-address} {name} {symbol} {logo}", + Use: "register {token-address} {name} {symbol} {logo} {website}", Short: "register meta data for a token", Args: cobra.ExactArgs(4), RunE: func(cmd *cobra.Command, args []string) (err error) { @@ -44,6 +44,7 @@ var tokenRegistryRegisterCmd = &cobra.Command{ var logo tokenregistry.Logo var name tokenregistry.Name 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) @@ -54,6 +55,9 @@ var tokenRegistryRegisterCmd = &cobra.Command{ if symbol, err = tokenregistry.SymbolFromString(args[3]); err != nil { return fmt.Errorf("invalid symbol %q: %w", args[3], err) } + if website, err = tokenregistry.WebsiteFromString(args[4]); err != nil { + return fmt.Errorf("invalid website %q: %w", args[4], err) + } pkeyStr := viper.GetString("token-registry-register-cmd-registrar") if pkeyStr == "" { @@ -91,7 +95,7 @@ var tokenRegistryRegisterCmd = &cobra.Command{ tokenRegistryProgramID := tokenregistry.ProgramID() createAccountInstruction := system.NewCreateAccountInstruction(uint64(lamport), tokenregistry.TOKEN_META_SIZE, tokenRegistryProgramID, registrarPubKey, tokenMetaAccount.PublicKey()) - registerTokenInstruction := tokenregistry.NewRegisterTokenInstruction(logo, name, symbol, tokenMetaAccount.PublicKey(), registrarPubKey, tokenAddress) + registerTokenInstruction := tokenregistry.NewRegisterTokenInstruction(logo, name, symbol, website, tokenMetaAccount.PublicKey(), registrarPubKey, tokenAddress) trx, err := solana.TransactionWithInstructions([]solana.TransactionInstruction{createAccountInstruction, registerTokenInstruction}, blockHashResult.Value.Blockhash, &solana.Options{ Payer: registrarPubKey, diff --git a/programs/tokenregistry/instruction.go b/programs/tokenregistry/instruction.go index 439882c..b933ee7 100644 --- a/programs/tokenregistry/instruction.go +++ b/programs/tokenregistry/instruction.go @@ -39,14 +39,15 @@ func DecodeInstruction(accounts []*solana.AccountMeta, compiledInstruction *sola return &inst, nil } -func NewRegisterTokenInstruction(logo Logo, name Name, symbol Symbol, tokenMetaKey, ownerKey, tokenKey solana.PublicKey) *Instruction { +func NewRegisterTokenInstruction(logo Logo, name Name, symbol Symbol, website Website, tokenMetaKey, ownerKey, tokenKey solana.PublicKey) *Instruction { return &Instruction{ BaseVariant: bin.BaseVariant{ TypeID: 0, Impl: &RegisterToken{ - Logo: logo, - Name: name, - Symbol: symbol, + Logo: logo, + Name: name, + Website: website, + Symbol: symbol, Accounts: &RegisterTokenAccounts{ TokenMeta: &solana.AccountMeta{tokenMetaKey, false, true}, Owner: &solana.AccountMeta{ownerKey, true, false},