@agoric/cosmos 0.34.2-dev-39d8f59.0 → 0.34.2-dev-a944f4c.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/upgrade.go +21 -7
- package/git-revision.txt +1 -1
- package/package.json +2 -2
package/app/upgrade.go
CHANGED
|
@@ -3,6 +3,7 @@ package gaia
|
|
|
3
3
|
import (
|
|
4
4
|
"encoding/json"
|
|
5
5
|
"fmt"
|
|
6
|
+
"reflect"
|
|
6
7
|
"strings"
|
|
7
8
|
"text/template"
|
|
8
9
|
|
|
@@ -77,14 +78,27 @@ func isFirstTimeUpgradeOfThisVersion(app *GaiaApp, ctx sdk.Context) bool {
|
|
|
77
78
|
return true
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
func buildProposalStepWithArgs(moduleName string, entrypoint string,
|
|
81
|
+
func buildProposalStepWithArgs(moduleName string, entrypoint string, extra any) (vm.CoreProposalStep, error) {
|
|
81
82
|
t := template.Must(template.New("").Parse(`{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
"module": "{{.moduleName}}",
|
|
84
|
+
"entrypoint": "{{.entrypoint}}",
|
|
85
|
+
"args": {{.args}}
|
|
86
|
+
}`))
|
|
86
87
|
|
|
87
|
-
|
|
88
|
+
var args []byte
|
|
89
|
+
var err error
|
|
90
|
+
if extra == nil {
|
|
91
|
+
// The specified entrypoint will be called with no extra arguments after powers.
|
|
92
|
+
args = []byte(`[]`)
|
|
93
|
+
} else if reflect.TypeOf(extra).Kind() == reflect.Map && reflect.TypeOf(extra).Key().Kind() == reflect.String {
|
|
94
|
+
// The specified entrypoint will be called with this options argument after powers.
|
|
95
|
+
args, err = json.Marshal([]any{extra})
|
|
96
|
+
} else if reflect.TypeOf(extra).Kind() == reflect.Slice {
|
|
97
|
+
// The specified entrypoint will be called with each of these arguments after powers.
|
|
98
|
+
args, err = json.Marshal(extra)
|
|
99
|
+
} else {
|
|
100
|
+
return nil, fmt.Errorf("proposal extra must be nil, array, or string map, not %v", extra)
|
|
101
|
+
}
|
|
88
102
|
if err != nil {
|
|
89
103
|
return nil, err
|
|
90
104
|
}
|
|
@@ -93,7 +107,7 @@ func buildProposalStepWithArgs(moduleName string, entrypoint string, opts map[st
|
|
|
93
107
|
err = t.Execute(&result, map[string]any{
|
|
94
108
|
"moduleName": moduleName,
|
|
95
109
|
"entrypoint": entrypoint,
|
|
96
|
-
"
|
|
110
|
+
"args": string(args),
|
|
97
111
|
})
|
|
98
112
|
if err != nil {
|
|
99
113
|
return nil, err
|
package/git-revision.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
a944f4c
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmos",
|
|
3
|
-
"version": "0.34.2-dev-
|
|
3
|
+
"version": "0.34.2-dev-a944f4c.0+a944f4c",
|
|
4
4
|
"description": "Connect JS to the Cosmos blockchain SDK",
|
|
5
5
|
"parsers": {
|
|
6
6
|
"js": "mjs"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"typeCoverage": {
|
|
40
40
|
"atLeast": 0
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "a944f4cdf36012e8c07fe0804de5e9f3532db3ce"
|
|
43
43
|
}
|