From 809f12ef467f608e6996aea19f90c118941ac862 Mon Sep 17 00:00:00 2001 From: Andrei Fleiser Date: Fri, 3 Oct 2025 18:33:56 +0200 Subject: [PATCH 1/2] station plugin tuto updated to use plugin-kit go module rather than the hello-world plugin pkg code --- docs/massaStation/guidelines.mdx | 2 +- docs/massaStation/hello-world-plugin.mdx | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/docs/massaStation/guidelines.mdx b/docs/massaStation/guidelines.mdx index 4e92047fe..1d7d96a78 100644 --- a/docs/massaStation/guidelines.mdx +++ b/docs/massaStation/guidelines.mdx @@ -50,7 +50,7 @@ Currently, Massa Station supports the following OS configurations: A plugin Zip Archive must contain the following files and adhere to the specified structure: -1. **Plugin Binary**: The plugin's binary, withch should follow the standards +1. **Plugin Binary**: The plugin's binary, which should follow the standards 2. **Logo**: The archive must include a valid image file that serves as the plugin's logo. Refer to [the Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types) for valid image formats. :::tip This logo will be displayed in the Massa Station interface. To ensure a good user experience, we recommend using a square image with a minimum size of 128x128 pixels. diff --git a/docs/massaStation/hello-world-plugin.mdx b/docs/massaStation/hello-world-plugin.mdx index d41b48579..29fa3731f 100644 --- a/docs/massaStation/hello-world-plugin.mdx +++ b/docs/massaStation/hello-world-plugin.mdx @@ -274,18 +274,20 @@ At this stage, we are running the API in standalone mode. In the next section, w ## Register to Massa Station -### Install the Massa Station Plugin package +### Install the Massa Station plugin-kit module -To be able to register the plugin with Massa Station, we need to install the Massa Station Plugin package. Indeed, this package contains the `RegisterPlugin` function that allows us to register the plugin to Massa Station. +To be able to register the plugin with Massa Station, we need to install the [plugin-kit](https://github.com/massalabs/station/tree/main/plugin-kit) go module. +The plugin-kit module provides useful features to develop Massa Station plugins in golang. +Here, we are going to use the `RegisterPlugin` function that allows us to register the plugin to Massa Station. Install the following package: ```bash -go get github.com/massalabs/station-massa-hello-world +go get github.com/massalabs/station/plugin-kit ``` This package will be imported to `my-plugin.go` file. So go ahead and add the following line to the imports section of `my-plugin.go`: ```go - "github.com/massalabs/station-massa-hello-world/pkg/plugin" + "github.com/massalabs/station/plugin-kit" ``` The import section of your `my-plugin.go` file should look like this: @@ -304,7 +306,7 @@ import ( "github.com/go-openapi/loads" "github.com/rs/cors" - "github.com/massalabs/station-massa-hello-world/pkg/plugin" + pluginKit "github.com/massalabs/station/plugin-kit" ) ``` Once this is done, we will add the registration logic to our main function. We want to add the following lines to the main function: @@ -315,7 +317,7 @@ Once this is done, we will add the registration logic to our main function. We w panic(err) } - plugin.RegisterPlugin(listener) // registers the plugin + pluginKit.RegisterPlugin(listener) // registers the plugin ``` They should be added right after the `server := initializeAPI()` line. In the end, your main function should look like this: @@ -334,7 +336,10 @@ func main() { panic(err) } - plugin.RegisterPlugin(listener) // registers the plugin + err = pluginKit.RegisterPlugin(listener) // registers the plugin + if err != nil { + panic(err) + } if err := server.Serve(); err != nil { panic(err) @@ -346,7 +351,7 @@ func main() { ``` :::info -`plugin.RegisterPlugin` is a function available in the [hello-world plugin package](https://github.com/massalabs/station-massa-hello-world/blob/main/pkg/plugin/register.go). +`pluginKit.RegisterPlugin` is a function available in the [plugin-kit module](https://github.com/massalabs/station/blob/main/plugin-kit/register.go). It facilitates the registration of a plugin with Massa Station, assigning a unique correlation ID to the plugin for identification purposes within the Massa Station system. ::: @@ -740,7 +745,7 @@ import ( "github.com/go-openapi/loads" "github.com/rs/cors" - "github.com/massalabs/station-massa-hello-world/pkg/plugin" + pluginKit "github.com/massalabs/station/plugin-kit" ) ``` From b487a2901b678cefcf8deccf613db95b33da0464 Mon Sep 17 00:00:00 2001 From: Andrei <34773578+fleandrei@users.noreply.github.com> Date: Tue, 7 Oct 2025 10:16:56 +0200 Subject: [PATCH 2/2] Update docs/massaStation/hello-world-plugin.mdx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/massaStation/hello-world-plugin.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/massaStation/hello-world-plugin.mdx b/docs/massaStation/hello-world-plugin.mdx index 29fa3731f..38a382b7d 100644 --- a/docs/massaStation/hello-world-plugin.mdx +++ b/docs/massaStation/hello-world-plugin.mdx @@ -338,8 +338,8 @@ func main() { err = pluginKit.RegisterPlugin(listener) // registers the plugin if err != nil { - panic(err) - } + panic(err) + } if err := server.Serve(); err != nil { panic(err)