Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 1003 Bytes

File metadata and controls

49 lines (35 loc) · 1003 Bytes

Tutorial

description

The subscan plugin gives more possibilities to subscan-essentials. Subscan sends the Extrinsic or Event received by the fetch block to the plugin, which can be customized and processed into formatted data, stored in the database, and presented through http api.

Quick start

Install gen tool

$ go get github.com/subscan-explorer/subscan-plugin/tools/gen-plugin

Gen plugin

# assume need generate balance module
$ gen-plugin balance

The directory structure is as follows:

├── dao
│   └── dao.go
├── http
│   └── http.go
├── main.go
├── model
│   └── model.go
└── service
    └── service.go

4 directories, 5 files

The logic can refer to https://github.com/subscan-explorer/subscan-essentials/tree/master/plugins/balance

Register plugin

package plugin
func init() {
	registerNative(balance.New())
	registerNative(system.New())
}