aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/args.go
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/args.go')
-rw-r--r--rpc/args.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/rpc/args.go b/rpc/args.go
index e61f28c4f..58a750415 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -1136,3 +1136,26 @@ func (args *SubmitWorkArgs) UnmarshalJSON(b []byte) (err error) {
return nil
}
+
+type SourceArgs struct {
+ Source string
+}
+
+func (args *SourceArgs) UnmarshalJSON(b []byte) (err error) {
+ var obj []interface{}
+ if err := json.Unmarshal(b, &obj); err != nil {
+ return NewDecodeParamError(err.Error())
+ }
+
+ if len(obj) < 1 {
+ return NewInsufficientParamsError(len(obj), 1)
+ }
+
+ arg0, ok := obj[0].(string)
+ if !ok {
+ return NewInvalidTypeError("source code", "not a string")
+ }
+ args.Source = arg0
+
+ return nil
+}