Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/massaStation/guidelines.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
23 changes: 14 additions & 9 deletions docs/massaStation/hello-world-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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:
Expand All @@ -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:

Expand All @@ -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)
Expand All @@ -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.
:::
Expand Down Expand Up @@ -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"
)
```

Expand Down