-
Notifications
You must be signed in to change notification settings - Fork 115
/
plugin.go
34 lines (27 loc) · 912 Bytes
/
plugin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package value
import (
"sync"
"github.com/iotaledger/hive.go/node"
"github.com/iotaledger/goshimmer/plugins/webapi"
)
// PluginName is the name of the web API DRNG endpoint plugin.
const PluginName = "WebAPI Value Endpoint"
var (
// plugin is the plugin instance of the web API DRNG endpoint plugin.
plugin *node.Plugin
once sync.Once
)
// Plugin gets the plugin instance.
func Plugin() *node.Plugin {
once.Do(func() {
plugin = node.NewPlugin(PluginName, node.Enabled, configure)
})
return plugin
}
func configure(_ *node.Plugin) {
webapi.Server().GET("value/attachments", attachmentsHandler)
webapi.Server().POST("value/unspentOutputs", unspentOutputsHandler)
webapi.Server().POST("value/sendTransaction", sendTransactionHandler)
webapi.Server().POST("value/sendTransactionByJson", sendTransactionByJSONHandler)
webapi.Server().GET("value/transactionByID", getTransactionByIDHandler)
}