Skip to content

Commit

Permalink
Add CLI to register CW->ERC pointers (sei-protocol#1591)
Browse files Browse the repository at this point in the history
  • Loading branch information
codchen authored Apr 25, 2024
1 parent 5541455 commit 89b9a07
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions x/evm/client/cli/native_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,32 @@ func NativeSendTxCmd() *cobra.Command {

return cmd
}

func NativeRegisterPointerCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "register-pointer [pointer type] [erc address]",
Short: `Register a CosmWasm pointer for an ERC20/721 contract. Pointer type is either ERC20 or ERC721`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}

msg := &types.MsgRegisterPointer{
Sender: clientCtx.GetFromAddress().String(),
PointerType: types.PointerType(types.PointerType_value[args[0]]),
ErcAddress: args[1],
}
if err := msg.ValidateBasic(); err != nil {
return err
}

return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}

flags.AddTxFlagsToCmd(cmd)

return cmd
}
1 change: 1 addition & 0 deletions x/evm/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func GetTxCmd() *cobra.Command {
cmd.AddCommand(CmdERC20Send())
cmd.AddCommand(CmdCallPrecompile())
cmd.AddCommand(NativeSendTxCmd())
cmd.AddCommand(NativeRegisterPointerCmd())
cmd.AddCommand(NewAddERCNativePointerProposalTxCmd())
cmd.AddCommand(NewAddERCCW20PointerProposalTxCmd())
cmd.AddCommand(NewAddERCCW721PointerProposalTxCmd())
Expand Down

0 comments on commit 89b9a07

Please sign in to comment.