You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
station plugin tuto updated to use plugin-kit go module rather than the hello-world plugin pkg code (#454)
* station plugin tuto updated to use plugin-kit go module rather than the hello-world plugin pkg code
* Update docs/massaStation/hello-world-plugin.mdx
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/massaStation/guidelines.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ Currently, Massa Station supports the following OS configurations:
50
50
51
51
A plugin Zip Archive must contain the following files and adhere to the specified structure:
52
52
53
-
1.**Plugin Binary**: The plugin's binary, withch should follow the standards
53
+
1.**Plugin Binary**: The plugin's binary, which should follow the standards
54
54
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.
55
55
:::tip
56
56
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.
Copy file name to clipboardExpand all lines: docs/massaStation/hello-world-plugin.mdx
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -274,18 +274,20 @@ At this stage, we are running the API in standalone mode. In the next section, w
274
274
275
275
## Register to Massa Station
276
276
277
-
### Install the Massa Station Plugin package
277
+
### Install the Massa Station plugin-kit module
278
278
279
-
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.
279
+
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.
280
+
The plugin-kit module provides useful features to develop Massa Station plugins in golang.
281
+
Here, we are going to use the `RegisterPlugin` function that allows us to register the plugin to Massa Station.
280
282
281
283
Install the following package:
282
284
```bash
283
-
go get github.com/massalabs/station-massa-hello-world
285
+
go get github.com/massalabs/station/plugin-kit
284
286
```
285
287
286
288
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`:
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
315
317
panic(err)
316
318
}
317
319
318
-
plugin.RegisterPlugin(listener) // registers the plugin
320
+
pluginKit.RegisterPlugin(listener) // registers the plugin
319
321
```
320
322
They should be added right after the `server := initializeAPI()` line. In the end, your main function should look like this:
321
323
@@ -334,7 +336,10 @@ func main() {
334
336
panic(err)
335
337
}
336
338
337
-
plugin.RegisterPlugin(listener) // registers the plugin
339
+
err = pluginKit.RegisterPlugin(listener) // registers the plugin
340
+
if err != nil {
341
+
panic(err)
342
+
}
338
343
339
344
if err := server.Serve(); err != nil {
340
345
panic(err)
@@ -346,7 +351,7 @@ func main() {
346
351
```
347
352
348
353
:::info
349
-
`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).
354
+
`pluginKit.RegisterPlugin`is a function available in the [plugin-kit module](https://github.com/massalabs/station/blob/main/plugin-kit/register.go).
350
355
351
356
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.
0 commit comments