cli: allow to provide 'data' for 'contract deploy' command
This commit is contained in:
parent
1a8ea8e2d6
commit
4e66293612
3 changed files with 84 additions and 3 deletions
13
cli/testdata/deploy/main.go
vendored
13
cli/testdata/deploy/main.go
vendored
|
@ -23,6 +23,13 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
value = "on create"
|
||||
sh := runtime.GetCallingScriptHash()
|
||||
storage.Put(ctx, mgmtKey, sh)
|
||||
|
||||
if data != nil {
|
||||
arr := data.([]interface{})
|
||||
for i := 0; i < len(arr)-1; i += 2 {
|
||||
storage.Put(ctx, arr[i], arr[i+1])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
storage.Put(ctx, key, value)
|
||||
|
@ -48,6 +55,12 @@ func GetValue() string {
|
|||
return val1.(string) + "|" + val2.(string)
|
||||
}
|
||||
|
||||
// GetValueWithKey returns stored value with the specified key.
|
||||
func GetValueWithKey(key string) string {
|
||||
ctx := storage.GetReadOnlyContext()
|
||||
return storage.Get(ctx, key).(string)
|
||||
}
|
||||
|
||||
// TestFind finds items with the specified prefix.
|
||||
func TestFind(f storage.FindFlags) []interface{} {
|
||||
ctx := storage.GetContext()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue