2022-07-07 14:41:01 +00:00
|
|
|
package params
|
2018-03-23 20:36:59 +00:00
|
|
|
|
2020-10-08 13:29:30 +00:00
|
|
|
import "fmt"
|
|
|
|
|
2018-03-23 20:36:59 +00:00
|
|
|
type (
|
2019-10-22 14:56:03 +00:00
|
|
|
// Params represents the JSON-RPC params.
|
2018-03-23 20:36:59 +00:00
|
|
|
Params []Param
|
|
|
|
)
|
|
|
|
|
2019-11-21 13:42:51 +00:00
|
|
|
// Value returns the param struct for the given
|
2018-03-23 20:36:59 +00:00
|
|
|
// index if it exists.
|
2020-06-04 11:58:47 +00:00
|
|
|
func (p Params) Value(index int) *Param {
|
2018-03-23 20:36:59 +00:00
|
|
|
if len(p) > index {
|
2020-06-04 11:58:47 +00:00
|
|
|
return &p[index]
|
2018-03-23 20:36:59 +00:00
|
|
|
}
|
|
|
|
|
2020-06-04 11:58:47 +00:00
|
|
|
return nil
|
2018-03-23 20:36:59 +00:00
|
|
|
}
|
|
|
|
|
2020-10-08 13:29:30 +00:00
|
|
|
func (p Params) String() string {
|
|
|
|
return fmt.Sprintf("%v", []Param(p))
|
|
|
|
}
|